From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id HAA14979; Thu, 28 Nov 2002 07:42:14 +0100 (MET) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id HAA15169 for caml-list@pauillac.inria.fr; Thu, 28 Nov 2002 07:42:14 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA25858 for ; Wed, 27 Nov 2002 13:17:38 +0100 (MET) Received: from courier.cs.helsinki.fi (courier.cs.helsinki.fi [128.214.9.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gARCHbX27629 for ; Wed, 27 Nov 2002 13:17:37 +0100 (MET) Received: from alkokrunni.cs.Helsinki.FI (alkokrunni.cs.helsinki.fi [::ffff:128.214.9.149]) (IDENT: root, TLS: TLSv1/SSLv3,168bits,DES-CBC3-SHA) by courier.cs.helsinki.fi with esmtp; Wed, 27 Nov 2002 14:17:36 +0200 Received: from alkokrunni.cs.Helsinki.FI (localhost [127.0.0.1]) by alkokrunni.cs.Helsinki.FI (8.12.5/8.12.5) with ESMTP id gARCHZZ8021049 for ; Wed, 27 Nov 2002 14:17:36 +0200 Received: from localhost (lealanko@localhost) by alkokrunni.cs.Helsinki.FI (8.12.5/8.12.5/Submit) with SMTP id gARCHZjV021046 for ; Wed, 27 Nov 2002 14:17:36 +0200 X-Authentication-Warning: alkokrunni.cs.Helsinki.FI: lealanko owned process doing -bs Received: from la by la.iki.fi with local (Exim 3.35 #1 (Debian)) id 18GpkG-0000Re-00 for ; Wed, 27 Nov 2002 02:08:00 +0200 Date: Wed, 27 Nov 2002 02:07:59 +0200 From: Lauri Alanko To: caml-list@inria.fr Subject: Re: [Caml-list] Why systhreads? Message-ID: <20021127000759.GB1557@la.iki.fi> References: <20021123090806.GA633@la.iki.fi> <20021125110133.A12077@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <20021125110133.A12077@pauillac.inria.fr> User-Agent: Mutt/1.4i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, Nov 25, 2002 at 11:01:33AM +0100, Xavier Leroy wrote: > One aspect of wisdom is to know when not to do something oneself, but > leave it to others. Scheduling I/O and computation concurrently, and > managing process stacks, is the job of the operating system. Trying > to do it entirely in a user-mode program is just not reasonable. Nevertheless that is the way many language implementations do it, mainly because their idea of what a thread should look like and how it should be used differs from what eg. Posix threads (or at least their common implementations) provide. Pthreads are just too heavy. So if I understand correctly, benefits of user-level threads include: * Thread creation speed (no context switches) * Minimal memory footprint * Flexibility (eg. inter-thread exceptions) whereas using system threads gives us: * Ease of implementation * Better handling of blocking functions in foreign libraries Now this is of course a matter of taste, but I'd say that the former weighs much more than the latter. The problems with gethostbyname can be averted even with user-level threads (the standard way is spawning an external server process for each gethostbyname call), whereas there's no way to get the benefits of user-level threads while using system threads (short of writing one's own threading system, which is also pretty much impossible unless you have at least continuations...) Thankfully it seems like system threads will be much lighter at least in Linux 2.6... Lauri Alanko la@iki.fi ------------------- 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