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 48024BB81 for ; Sat, 15 Oct 2005 07:52:58 +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 j9F5qvlX001639 for ; Sat, 15 Oct 2005 07:52:58 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA12799 for ; Sat, 15 Oct 2005 07:52:57 +0200 (MET DST) Received: from disorder.primate.net (disorder.primate.net [198.144.194.12]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j9F5qtMA005670 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sat, 15 Oct 2005 07:52:56 +0200 Received: from disorder.primate.net (localhost [127.0.0.1]) by disorder.primate.net (8.13.5/8.13.5/Debian-3) with ESMTP id j9F5qrZq011130 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 14 Oct 2005 22:52:53 -0700 Received: from localhost (localhost [[UNIX: localhost]]) by disorder.primate.net (8.13.5/8.13.5/Submit) id j9F5qnBv011129 for caml-list@inria.fr; Fri, 14 Oct 2005 22:52:49 -0700 X-Authentication-Warning: disorder.primate.net: itz set sender to itz@buug.org using -f Received: from itz by unicorn with local (Exim 3.36 #1 (Debian)) id 1EQeyL-0001He-00; Sat, 15 Oct 2005 01:52:45 -0400 To: caml-list@inria.fr Subject: Re: [Caml-list] vm threads References: <8764rzbcw6.fsf@buug.org> <20051015.142304.106269859.garrigue@math.nagoya-u.ac.jp> X-Unicorn-Archive: yes From: Ian Zimmerman Date: 15 Oct 2005 01:52:45 -0400 In-Reply-To: <20051015.142304.106269859.garrigue@math.nagoya-u.ac.jp> Message-ID: <87zmpb9viq.fsf@buug.org> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: Ian Zimmerman X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.6 (disorder.primate.net [127.0.0.1]); Fri, 14 Oct 2005 22:52:53 -0700 (PDT) X-Miltered: at concorde with ID 43509939.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 43509937.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 threads:01 itz:01 ocaml's:01 threads:01 ocaml:01 non-blocking:01 atm:98 unix:01 unix:01 zimmerman:01 jacques:01 jacques:01 primitives:02 thread:02 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 Ian> Are Ocaml's VM threads preemptive? That is, does the virtual Ian> machine actually have a timer and give a slice to each thread? Or Ian> does a thread run until it's blocked? Jacques> The timer signal is used, so they are preemptive. This is Jacques> however only true for threads running ocaml code. There is no Jacques> way to switch thread during C calls, so that all potentially Jacques> blocking C calls should be manually converted to non-blocking Jacques> ones (this is already done for the standard library and the Jacques> Unix module.) This can also create problems when somebody else Jacques> needs the timer signal (for instance the Graphics module.) The reason I asked was: when writing a library that uses C extension code and a global data structure in the C code, can I just use system thread primitives for synchronization (that would be pthreads since I am only thinking about Unix type systems at least ATM) and not worry about VM threads? >>From your post the answer seems to be yes. -- "It's not true or not." A reality show producer (real quote)