From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=DNS_FROM_RFC_POST, HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 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 9E3B8BBAF for ; Sat, 27 Jun 2009 18:27:14 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkwCALvkRUpKfU6TlGdsb2JhbACCJDAti0CJfj8BAQEBCQsICRMDpDaBGo9HAQMCBIQJBQ X-IronPort-AV: E=Sophos;i="4.42,301,1243807200"; d="scan'208";a="42536367" Received: from ey-out-1920.google.com ([74.125.78.147]) by mail4-smtp-sop.national.inria.fr with ESMTP; 27 Jun 2009 18:27:14 +0200 Received: by ey-out-1920.google.com with SMTP id 5so151776eyb.22 for ; Sat, 27 Jun 2009 09:27:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=+VSbFyhP7paupQ2AEDVuCS8zEVnegYZ1rP6KGjOk3qU=; b=uXLLApil+Uy9gSFdeAinEbga6azCu1L+4VbQ4aYuHP+b6yG2mx+/+rQ2vLrbiYJbnB qEMHiTkiLcDd2ueipramhfxLWwyp0t3AZBUwvZcXa1/v7kvUNdOlXJeMndRA7h+dgyZv QvLK1Qyzeq/bnn1+CMbq3IcmBxXhVR411mCSc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=DClYoO/v9DAbUbiI6RJfCDbgc9mBZVN1L8gSxW2q8anhzrh+AlQRN8QXNRreJfGXT6 wgdicoqfD/dOGDwEDpTJXpZBuMQqqIp5DxbLwJzVemyBo1sICCY30Ve8xKw+ouFDsJRC auSWwIIuaMtpeH9x40FBUi1uTP1zWD4Wt8Nvw= MIME-Version: 1.0 Received: by 10.216.23.72 with SMTP id u50mr1520933weu.178.1246120033322; Sat, 27 Jun 2009 09:27:13 -0700 (PDT) In-Reply-To: <906164100906270339j3af90566ta6545d3086449219@mail.gmail.com> References: <906164100906270339j3af90566ta6545d3086449219@mail.gmail.com> Date: Sat, 27 Jun 2009 18:27:13 +0200 Message-ID: <4d1b2df20906270927v3e32513fh9ad355b2bcdc884@mail.gmail.com> Subject: Re: [Caml-list] Threads - how it actually works? From: Philippe Wang To: =?ISO-8859-2?Q?Micha=B3_Maciejewski?= Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=0016364d27f1ef0677046d56edf2 X-Spam: no; 0.00; allocates:01 michal:01 ocaml:01 looped:01 ocaml:01 beginner's:01 bug:01 allocates:01 michal:01 looped:01 beginner's:01 bug:01 2009:98 lights:98 10.:98 X-Attachments: cset="ISO-8859-2" cset="ISO-8859-2" --0016364d27f1ef0677046d56edf2 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable if you have a thread that never allocates any value in the memory heap, the= n the thread may prevent the GC from working properly... 2009/6/27 Micha=B3 Maciejewski > Hi, > > Some time ago I had some problems with threads. I had to make a > traffic lights simulation with cars as a academic project. I decided > to write it using ocaml with graph module and threads for timing > (since thread pausing didn't work in the same thread that the graph > module worked). If I remember correctly there was a loop in graph > module thread that was drawing some objects. Another looped thread was > changing objects positions and then was paused for some amount of time > using (I think) Unix module. I know that wasn't a good and optimal way > to do it, but I had only few days for it. > > Now the problem was that one of those thread never worked. It looked > like a graph thread was using whole cpu time, and there was no context > switching. Don't ask me to paste any code, because I dont have it. It > was quite long time ago and I had to do my project without timing. :-) > It was ocaml 10.*. So how threads are actually implemented in caml? > Using some kind of timing or atomic operations? > > regards > M > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --=20 Philippe Wang mail@philippewang.info --0016364d27f1ef0677046d56edf2 Content-Type: text/html; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable if you have a thread that never allocates any value in the memory heap, the= n the thread may prevent the GC from working properly...



2009/6/27 Micha=B3 Maciejewski &l= t;michal.m.pl@gmail.com>
Hi,

Some time ago I had some problems with threads. I had to make a
traffic lights simulation with cars as a academic project. I decided
to write it using ocaml with graph module and threads for timing
(since thread pausing didn't work in the same thread that the graph
module worked). If I remember correctly there was a loop in graph
module thread that was drawing some objects. Another looped thread was
changing objects positions and then was paused for some amount of time
using (I think) Unix module. I know that wasn't a good and optimal way<= br> to do it, but I had only few days for it.

Now the problem was that one of those thread never worked. It looked
like a graph thread was using whole cpu time, and there was no context
switching. Don't ask me to paste any code, because I dont have it. It was quite long time ago and I had to do my project without timing. :-)
It was ocaml 10.*. So how threads are actually implemented in caml?
Using some kind of timing or atomic operations?

regards
M

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.in= ria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



--
Philippe Wang
=A0 <= a href=3D"mailto:mail@philippewang.info">mail@philippewang.info
--0016364d27f1ef0677046d56edf2--