Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Request: matrix_init function in Array
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-02-19 (18:18)
From: Will Benton <willb@c...>
Subject: Re: [Caml-list] Re: feature priorities (multithreading)
On Wed, Feb 19, 2003 at 11:45:52AM -0600, Brian Hurt wrote:

> 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.

Not necessarily -- most m:n threads packages have non-preemptive user
thread schedulers, which means that a compute-intensive user thread that
never enters the kernel and doesn't yield the processor can monopolize
a kernel thread.  That might be a pathological example (since if
you're trying to run >N compute-intensive threads on N processors,
you're in trouble), but someone might argue that an application that
context-switches enough to *require* m:n instead of 1:1 is
pathological in a different way.

If you need preemptability, then the best-of-both-worlds approach is
to find a system on which kernel thread context switches are cheap.
:-)  (Making KT switches cheap seems to be the direction that the
industry is going -- Sun, for example, has dropped their m:n threads
package for solaris.)


Will Benton 
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: