3 ms·
The problem is not Linux per se, it's the fact that pthread_create [1] reserves 2M for the stack, so the process runs out of memory if you have 1 million thread
by _old_dude_ 4y ago
The problem is not Linux per se, it's the fact that pthread_create [1] reserves 2M for the stack, so the process runs out of memory if you have 1 million threads (1M * 2M == 2T)
[1] https://man7.org/linux/man-pages/man3/pthread_create.3.html https://man7.org/linux/man-pages/man3/pthread_create.3.html
- akira2501 4y agoWell.. by default. You can set it to the minimum if you like, which is 16384 bytes.
- PaulDavisThe1st 4y agoThe stack size is configurable ahead of time. It's not fixed at 2M.
- akvadrako 4y agoIt only reserves virtual memory.
- cogman10 4y agoWhich has a real nasty habit of becoming real memory as applications process stuff.