caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Threads - how it actually works?
@ 2009-06-27 10:39 Michał Maciejewski
  2009-06-27 16:27 ` Philippe Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Michał Maciejewski @ 2009-06-27 10:39 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Threads - how it actually works?
  2009-06-27 10:39 [Caml-list] Threads - how it actually works? Michał Maciejewski
@ 2009-06-27 16:27 ` Philippe Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Wang @ 2009-06-27 16:27 UTC (permalink / raw)
  To: Michał Maciejewski; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1629 bytes --]

if you have a thread that never allocates any value in the memory heap, then
the thread may prevent the GC from working properly...



2009/6/27 Michał Maciejewski <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
> 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
>



-- 
Philippe Wang
  mail@philippewang.info

[-- Attachment #2: Type: text/html, Size: 2327 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-27 16:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-27 10:39 [Caml-list] Threads - how it actually works? Michał Maciejewski
2009-06-27 16:27 ` Philippe Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).