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 firstname.lastname@example.org
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:12 EST