5 ms·
Being able to build web servers with 10,000 threads w/ clean imperative code rather than event-driven yo-yo pattern finite state machines. It's what Google does
by jart 5y ago
Being able to build web servers with 10,000 threads w/ clean imperative code rather than event-driven yo-yo pattern finite state machines. It's what Google does. They limit stack size to 60kb for just that reason.
- floatboth 5y agoKernel threads have tons of switching overhead so state machines are still better. Get your compiler to compile clean imperative code into them :) (okay, by "clean" I do mean littered with `.await`, but it's still structurally clean)
- wahern 5y agoYou don't need kernel scheduling for stackful threading. So-called green threading was common long before event-oriented asynchronous programming became popular with the advent of kqueue and epoll. See, e.g., https://www.gnu.org/software/pth/ https://www.gnu.org/software/pth/ That said, you can make kernel-aware user-controlled context switching much faster than it is currently: https://www.theregister.com/2020/08/10/google_scheduling_code_reaches_linux/ https://www.theregister.com/2020/08/10/google_scheduling_cod...