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 RAA31465; Mon, 12 Apr 2004 17:19:51 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 RAA31121 for ; Mon, 12 Apr 2004 17:19:50 +0200 (MET DST) Received: from gatekeeper.elmer.external.excelhustler.com (gatekeeper.excelhustler.com [68.99.114.105]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3CFJnYM031174 for ; Mon, 12 Apr 2004 17:19:49 +0200 Received: from chatterbox.elmer.internal.excelhustler.com (unknown [192.168.0.12]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client CN "chatterbox.elmer.internal.excelhustler.com", Issuer "excelhustler.com" (not verified)) by gatekeeper.elmer.external.excelhustler.com (Postfix) with ESMTP id C8161E0111; Mon, 12 Apr 2004 10:19:47 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id 599F45C005; Mon, 12 Apr 2004 10:19:47 -0500 (CDT) Received: from wile.internal.excelhustler.com (wile.internal.excelhustler.com [192.168.1.34]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id E3F735C004; Mon, 12 Apr 2004 10:19:46 -0500 (CDT) Received: by wile.internal.excelhustler.com (Postfix, from userid 1000) id 04B6331010; Mon, 12 Apr 2004 10:19:48 -0500 (CDT) Date: Mon, 12 Apr 2004 10:19:48 -0500 From: John Goerzen To: caml-list@inria.fr Subject: [Caml-list] Threading: Using and Building Message-ID: <20040412151948.GA11370@excelhustler.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i X-Scanned-By: clamscan at chatterbox.elmer.internal.excelhustler.com X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; threading:01 threads:01 implemented:01 threading:01 threads:01 introductory:99 behave:01 -thread:01 -thread:01 bug:01 maximally:01 ocamlmake:01 model:01 linked:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 258 Hello, I am looking at using multi-threaded programs in OCaml, but have some questions: *** Regarding the thread support itself Chapter 24 of the OCaml documentaion says that "The threads library is implemented by time-sharing on a single processor. It will not take advantage of multi-processor machines." That's bad. But then later on I notice that there are two threading options: system threads and VM-level threads. The introductory paragraph does not seem to apply to system threads which, in other languages at least, do not behave that way. So I am rather puzzled about the actual level of thread support is here. *** Regarding building programs and libraries with threading support My next concern is building programs and libraries to support threading. Chapter 24 also mentions that programs must be linked with -thread, and all object files compiled with -thread, if the final result is to support threads. Alternatively, -vmthread could be substituted. So my questions are: 1. Few libraries out there build themselves with -thread or -vmthread. Is that to be considered a bug? Is there a workaround short of recompiling them? 2. Can a library or object file built with -thread or -vmthread be used in a non-threaded program (one that does not use -thread or -vmthread?) Can it be used in a threaded program that uses the *other* option? (-thread vs. -vmthread) Does the answer to this question vary depending on whether C code is used, or are there other things that can be done in the code to increase compatibility? 3. I am assuming that -thread and -vmthread are not universally supported across OCaml platforms. Would it be correct to assume, then, that one should check for the presence of -thread or -vmthread at build time? Do there exist platforms for which neither are supported? 4. If I am developing an application... what can I do if it is multi-threaded but depends on libraries that are not built in a multi-threaded fashion on the user's system? What if the libraries are built with the wrong type of threading (-thread vs. -vmthread)? What if some libraries are built with one type and some with another? 5. If I am developing a library... what must I do to make it maximally compatible with non-threaded applications and both types of threaded applications the user may be developing? 6. What considerations must one take into account when developing C interfaces that will be used in multithreaded OCaml programs? 7. Do any of the standard build systems (OCamlMake, configure.in, etc) take into account the above answers in a useful way for an application or library developer? 8. How do I know which, if any, standard or third-party libraries installed on my system are threadsafe, and which threading model they support? Thanks, John ------------------- 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