4 ms·
You can have lots of threads – they are just thread stacks holding execution context – but that doesn't mean they will run well. You also need lots of execution
by vinay_ys 3y ago
You can have lots of threads – they are just thread stacks holding execution context – but that doesn't mean they will run well. You also need lots of execution units on which they can run. Even then, if any thread can sleep/wake-up at any random time, you will have a lot of jitter in your thread response latency. So, such large number of threads is anti efficient or predictable performance. It is not about that at all but instead it is about programming style/habits.
- fulafel 3y agoYou don't need more execution units than for green threads. Typically in these zillion thread use cases, threads wake up for IO, queue activity, etc and are not spinning doing CPU bound computation, so not a hard problem for the OS thread scheduler.