Browse thread
[Caml-list] Request: matrix_init function in Array
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Brian Hurt <brian.hurt@q...> |
| Subject: | Re: [Caml-list] Re: feature priorities (multithreading) |
On Wed, 19 Feb 2003, Ranjan Bagchi wrote: > I've been reading LtU lately (lambda.weblogs.com) and > came across this paper: > http://www.sics.se/~joe/apachevsyaws.html detailing a > high-performance web-server written in Erlang. > > One point here is that the threads in Erlang uses a > ton of "microthreads" which don't use OS Threads at > all (and don't incur the overhead). Stackless python > (www.stackless.com) does this too, and is able to > support massive concurrency. Yep. These are called "userspace" or "green" threads. They're fairly easy to do- all you have to do is swap stacks. Some experimentation on my part showed that on a P4, you could task switch between two such user space threads in 30-60 clock cycles on the x86- less expensive than a cache miss. User space threads have some problems. First off, they don't take advantage of multiple CPUs, or SMT CPUs. Second, and more importantly, if one thread blocks- either by doing blocking I/O, or page faulting- all threads block. A better approach is what's called the M-by-N approach. You have M kernel level threads (so you can take advantage of M parallel CPUs) each executing threads from a pool of N user space threads. This gives you the best of both worlds. Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners