3 ms·
You could just spawn threads with smaller stacks. Also afaik that memory won't ever get paged in if it isn't used? So I don't know if it matters much. Also, id
by staticassertion 5y ago
You could just spawn threads with smaller stacks. Also afaik that memory won't ever get paged in if it isn't used? So I don't know if it matters much.
Also, idle threads aren't a problem, even on a system under load. Especially on a desktop.
Also also, there's no global threadpool, which means if you have K programs on N codes and K > N it's a moot point trying to save threads. Any desktop has K > N. So reducing thread usage in all of your processes is unlikely to help.
- IgorPartola 5y agoYou said what I would have. Stack size of 100k is plenty for lightweight threads. 100MB for 1000 threads isn’t much for a modern system.
- asdfasgasdgasdg 5y agoMore to the point, only allocated pages matter from the perspective of resident memory. As long as the thread stacks are not actually too deep, it doesn't really matter very much the nominal depth.