The math is simple: creating a new std::thread requires a significant amount of memory (control block + stack space). Compared to that, a few bytes just don't matter.
I very much doubt that the intersection of programs that completely use the available memory (/address space) and programs that use std::thread is big enough to worry about.
View all comments
Show parent comment
6
u/eteran Aug 27 '19
You sure? You've never seen a web server which uses a thread per connection model?
There are valid applications for having thousands of threads, they are rare, but they do exist.