Re: Linus on Linux, Apache and Threads

Larry McVoy (lm@bitmover.com)
Tue, 27 Apr 1999 16:30:24 -0600


: Some OSes have true lightweight thread switching (it takes place entirely
: in userspace). It's very fast...

Last I checked, Linux process context switches were faster than Solaris
thread context switches.

The speed issue is a red herring anyway. People get seduced by the
oh-so-fast user level threads (which definitely can context switch
faster than processes) and then forget to realize that each of those
oh-so-lightweight threads has a stack. If each stack is a page (and
maybe an allocated page followed by an unallocated page so it can page
fault and get auto filled by the kernel), and you have a 1000 threads,
that's 4MB in stacks. Not so light weight.

My favorite thread quote:

Threads are like salt. I like salt, you like salt, we all
like salt, but we eat more pasta than salt.

: Many Un*x OSes have two-tiered thread
: implementations (both kernel thread switching and userspace thread
: switching). This works pretty well but is complex.

Really complex.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/