I using an Amazon EC2 server small instance and by default it allows 382 threads per process. However, I wish to run 10,000 threads in a single process. Recently, I learned that this can be done by either reducing the stack limit or increasing virtual memory.
To the best of my knowledge, virtual memory can be increased by increasing RAM or swap space in Linux. Increasing RAM is not an option. I know how to increase swap space, but I am not sure what the optimum size I should go for is.
What I am not clear on is, how do swap space and RAM work when I run threads? Is there some specific limit after which swap memory makes the threads slow? Is there an optimal amount of swap space I should use?: