[TUHS] the true reason why c++ always wins

Bakul Shah via TUHS tuhs at tuhs.org
Fri May 29 09:39:21 AEST 2026


On May 28, 2026, at 3:24 PM, Dan Cross via TUHS <tuhs at tuhs.org> wrote:
> 
> Not really. "Worker threads" are a means for structuring
> _concurrency_, that is multiple logical flows of execution in a
> program. They're implemented in Linux, as in a bunch of other systems,
> because they're a convenient programming abstraction, and having a
> schedulable execution context is useful. But they're largely
> orthogonal to the whole fast vs slow thing and how those interact with
> signals (and thus `EINTR`): if every system call was asynchronous,
> having threads in a kernel would still be handy.

More specifically, or at least the way I used them in the
past, some background kernel task may need to wait to gain
some resource or on some event. If you use a thread, you can
write sequential code (wait for X; do Y; wait for Z; do W
etc.). Without such a thread you must not make any blocking
calls, so you have to break up this code in a bunch of
callbacks (when X happens, callback a fn to do Y and
associate a callback for "do W" with Z etc.) -- this is the
usual simulate threads in an event loop scenario.  Multiple
such threads may be added for increased concurrency.


More information about the TUHS mailing list