From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id A180ABB81 for ; Sat, 15 Oct 2005 07:23:17 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j9F5NHEI031695 for ; Sat, 15 Oct 2005 07:23:17 +0200 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 HAA12122 for ; Sat, 15 Oct 2005 07:23:16 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j9F5NE6j031688 for ; Sat, 15 Oct 2005 07:23:15 +0200 Received: from localhost (suiren [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id j9F5N8si005600; Sat, 15 Oct 2005 14:23:08 +0900 (JST) Date: Sat, 15 Oct 2005 14:23:04 +0900 (JST) Message-Id: <20051015.142304.106269859.garrigue@math.nagoya-u.ac.jp> To: itz@buug.org Cc: caml-list@inria.fr Subject: Re: [Caml-list] vm threads From: Jacques Garrigue In-Reply-To: <8764rzbcw6.fsf@buug.org> References: <8764rzbcw6.fsf@buug.org> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 43509245.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 43509242.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 threads:01 ocaml's:01 threads:01 ocaml:01 non-blocking:01 unix:01 jacques:01 jacques:01 simplify:02 thread:02 thread:02 graphics:02 garrigue:03 garrigue:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 > Are Ocaml's VM threads preemptive? That is, does the virtual machine > actually have a timer and give a slice to each thread? Or does a thread > run until it's blocked? The timer signal is used, so they are preemptive. This is however only true for threads running ocaml code. There is no way to switch thread during C calls, so that all potentially blocking C calls should be manually converted to non-blocking ones (this is already done for the standard library and the Unix module.) This can also create problems when somebody else needs the timer signal (for instance the Graphics module.) System threads are most costly (they use system resources), but they simplify greatly working with C. Jacques Garrigue