[TUHS] Threads vs... not

Larry McVoy lm at mcvoy.com
Thu Aug 5 08:51:07 AEST 2021


On Wed, Aug 04, 2021 at 06:41:08PM -0400, John Cowan wrote:
> On Wed, Aug 4, 2021 at 6:02 PM Larry McVoy <lm at mcvoy.com> wrote:
> 
> 
> >      A computer is a state machine. Threads are for people who can't
> > program
> >      state machines.
> >
> >      Alan Cox
> 
> 
> Orly?  Try embedding an LL(1) parser in an event loop that gives you a new
> event every time a block is read off the disk.
> 
> Event loops are just manual CPS transformations of coroutines -- but why do
> the transformation manually instead of having your compiler do it for you?

The counter to this is Solaris tried to allocate a thread for each 8K page
on it's way to disk.  The thread stack was 16K.  This model, while seen as
ever so elegant, means that 2/3rds of main memory were thread stacks.

Sometimes threads make sense, there they did not.
-- 
---
Larry McVoy            	     lm at mcvoy.com             http://www.mcvoy.com/lm 


More information about the TUHS mailing list