4 ms·
> The most commonly cited drawback of OS-level threads is that they use a lot of RAM. "RAM" is inaccurate in that sentence. It's important to realize that the
by ynik 6y ago
> The most commonly cited drawback of OS-level threads is that they use a lot of RAM.
"RAM" is inaccurate in that sentence.
It's important to realize that the common knowledge "you can't have 10k threads" comes from 2 decades ago when we were running 32-bit CPUs.
A thread may only need a couple pages of RAM; but it needs a whopping 1 MB (or more) of virtual address space (at least with default stack sizes). You simply can't start 10k threads in a 32-bit process, as you'd need 10 GB of address space. OS-level threads use a lot of address space and thus were unsuitable for the C10k problem back in the day. But in 64-bit world, 10 GB is nothing, the address space usage can almost be ignored and the RAM usage is much less bad. (but: RAM usage of page table entries also needs to be considered. the article forgot about this)
Of course, just because it works now doesn't mean that 10k threads are a good idea.
- Koiwai 6y agoNice elaboration!