lkml.org 
[lkml]   [2001]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    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
    pessimizing
    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
    expect
    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 majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 12:55    [W:4.329 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site