English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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