[lkml]   [2000]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: thread rant
On Fri, 1 Sep 2000, Michael Bacarella wrote:

> Q: Why do we need threads?
> A: Because on some operating systems, task switches are expensive.

maybe this problem will help you understand threads better:

design a webserver which supports SSL session keys. consider the
performance of your webserver on single CPU and multiple CPU boxes.
consider also the performance of your webserver on datasets which do
not fit within RAM, hence requiring disk i/o. and finally, consider
the effect of having one disk spindle versus multiple disk spindles.

in this problem, the "SSL session key" requirement is there so that state
information for previous connections has to be available to efficiently
process future connections. (the ssl session key reduces the number of
times the RSA key signature needs to be performed.)

the SMP requirement is to indicate why single process select loop won't
always cut it. (especially if you're doing SSL you'd like to grind crypto
on all CPUs).

the disk i/o, multiple spindle requirement is there so you consider what
it takes to get a disk array with 50 disks in it going full-tilt.
(nevermind stuffing the elevator on a single disk -- i'm just trying to
make it really obvious how much parallelism may be available in a system.)

yup you can do this without threads. apache-1.3+mod_ssl for example.

but it's not fun, and it's a lot more work on the portability side.
inter-process shared memory and inter-process semaphores are notoriously
different across platforms... just look at the "mm" library from mod_ssl
(which is a less puke-filled version of what's in


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

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