[lkml]   [2001]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: threading question
bert hubert wrote:

> > from Larry McVoy's home page attributed to Alan Cox illustrates this
> > reasonably well: "A computer is a state machine. Threads are for people
> > who can't program state machines." Sorry for not being more helpful.
> I got that response too. When I pressed kernel people for details it turns
> out that they think having hundreds of runnable threads/processes (mostly
> the same thing under Linux) is wasteful. The scheduler is just not optimised
> for that.

The scheduler can be optimized for that, so far at the cost of
the common case with few threads. The bigger problem here is that
your cpu (particularly TLB's and caches) aren't optimized for switching
between a lot of threads either. This will always be a problem as long
as cpu's have level 1 caches much smaller than the combined working
set of your threads. So run one thread per cpu, perhaps two if you
io stalls. The task at hand may easily be divided into many more parts,
but serializing those extra parts will be better for performance.

Helge Hafting
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:55    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean