4 ms·
Hmm feels like there is a bit of a misunderstanding on the meaning and cost of threads and how the OS schedules work from threads onto logical CPUs and what sta
by nhoughto 5y ago
Hmm feels like there is a bit of a misunderstanding on the meaning and cost of threads and how the OS schedules work from threads onto logical CPUs and what state they are in. It is expected that processes might use more than 1 thread, and it is expected that you would have more processes than logical CPUs. Can not-dead process exist without a thread at all? I'd expect not.
7000+ threads does seem like a lot though and agree there is the general lack of caring about resource consumption in all forms, eg Electron apps. At this point having lots of threads seems almost expected by various OSs and something they solve for to reduce the cost of it so the user doesn't have to worry about it.
- jayd16 5y ago>Can not-dead process exist without a thread at all? I'd expect not. Isn't this the case for some older cooperative threading OSes? It's possible in theory, anyway.
- astrange 5y agoIf all the threads are idle then you could exit all of them; this makes sense if they're using async system calls. The OS would just create a new thread in the process to resume it again. Of course, there's a lot of tradeoffs between that and just keeping an idle thread around.