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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id ADDB2BC57 for ; Mon, 29 Nov 2010 17:33:31 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah0DAIxk80zAbSoIYGdsb2JhbACDUJEsjS9YCx8lBB6ySJBWgSGDM3ME X-IronPort-AV: E=Sophos;i="4.59,276,1288566000"; d="scan'208";a="80496001" Received: from einhorn.in-berlin.de ([192.109.42.8]) by mail4-smtp-sop.national.inria.fr with ESMTP; 29 Nov 2010 17:33:31 +0100 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from localhost (okapi.in-berlin.de [192.109.42.117]) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id oATGXUG6002963 for ; Mon, 29 Nov 2010 17:33:30 +0100 Received: from e178028169.adsl.alicedsl.de (e178028169.adsl.alicedsl.de [85.178.28.169]) by webmail.in-berlin.de (Horde Framework) with HTTP; Mon, 29 Nov 2010 17:33:30 +0100 Message-ID: <20101129173330.497268aei2bmkh5m@webmail.in-berlin.de> Date: Mon, 29 Nov 2010 17:33:30 +0100 From: "Oliver Bandel" To: caml-list@yquem.inria.fr Subject: Re: Threading and SharedMem (Re: [Caml-list] Re: Is OCaml fast?) References: <20101123232742.GC28768@siouxsie> <1534555381.33107.1290723160355.JavaMail.root@zmbs4.inria.fr> <4CEEE852.5070101@inria.fr> <20101128181433.GA1689@siouxsie> <1291040394.16005.529.camel@thinkpad> <20101129171212.8439157ahjexnnq4@webmail.in-berlin.de> <1291047880.16005.533.camel@thinkpad> In-Reply-To: <1291047880.16005.533.camel@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) 4.3.3 X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 X-Spam: no; 0.00; bandel:01 in-berlin:01 threading:01 ocaml:01 gerd:01 stolpmann:01 bandel:01 gerd:01 stolpmann:01 in-berlin:01 0100,:01 ocaml:01 compiler:01 low-level:01 libs:01 Zitat von "Gerd Stolpmann" : > Am Montag, den 29.11.2010, 17:12 +0100 schrieb Oliver Bandel: >> Zitat von "Gerd Stolpmann" : >> >> > Am Sonntag, den 28.11.2010, 19:14 +0100 schrieb >> > oliver@first.in-berlin.de: >> >> On Thu, Nov 25, 2010 at 11:50:58PM +0100, Fabrice Le Fessant wrote: >> >> [...] >> >> > The main problem was that other languages have bigger standard >> >> > libraries, whereas OCaml has a very small one (just what is needed >> >> > to compile the compiler, actually). In many problems, you could >> >> > benefit from using a very simple shared-memory library (in >> >> > mandelbrot, the ocaml multicore solution has to copy the image in a >> >> > socket between processes, whereas it could just be in a shared >> >> > memory segment), >> >> >> >> >> >> ...so you work on a shared-mem module?! >> > >> > Don't know what Fabrice is referring to, but at least I work on a >> > multicore-enabling library: >> > >> > =20 >> https://godirepo.camlcity.org/svn/lib-ocamlnet2/trunk/code/src/netmultico= re/ >> > >> > This is work in progress and highly experimental. What's currently >> > available: >> > >> > - managing processes and resources like files, shared memory objects >> > etc. >> > - support for message passing via Netcamlbox (another library) >> > - low-level only so far: shared memory, including copying Ocaml values >> > to and from shm >> [...] >> >> You use shared mem(?), but you link only to *.ml files, >> and I see no *.c there. > > cd ../netsys > > it's part of a larger package ah, ok. :) > >> >> How can this be done? >> >> At least not via the libs that are shipped with OCaml?! >> >> I would have expected some *.c for the shared mem part and >> the creation of Caml-values.... >> >> >> Ciao, >> Oliver >> >> P.S.: OCaml also provides a Thread-Lib, which seems to use pthread-lib. >> Normally this should help in making things possible to run =20 >> on multiple >> cores. What are the restrictions that this does not run that way? >> Somehow... when all values are handled via one GC, then those thre= ads >> are somehow bound together, but on the other side, it works thread= ed, >> and consumer-worker pipes and such stuff can be used. >> So... somehow the GC seems to be the point, where the show will be >> stopped? (Anyone who has looked inside OCaml here more detailed?) > > Quite easy: there is a global lock, and when Ocaml code runs, this lock > must be acquired. So only one of the pthreads can have this lock, [...] Aha, ok. Thanks for the details. Wouldn't it be possible for each thread to have it's own GC, and letting the global lock on global GC only be used, when global variables are touched? Then this could be added to the Threads-module... Ciao, Oliver