Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Pre-emptive multitasking
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jonathan Roewen <jonathan.roewen@g...>
Subject: Re: [Caml-list] Pre-emptive multitasking
> The GC isn't thread-safe. 

What would it take to make it thread-safe? I plan to make a custom
native code runtime anyway, so could try working on that problem

> This means that when OCaml code runs, it
> must be protected by a global mutex.  If you have two threads running
> OCaml code, they will contend for this mutex, and run (around) 50% of
> the time each.  If you have two CPUs you won't gain any benefit. 

We plan on running separate runtimes for multi-processor systems.

> The standard solution would be to run one OCaml thread and lots of C
> threads

This is not a solution: we're going for an almost pure OCaml operating
system (need asm, etc). I'm more interested in the ins and outs of the
scheduler for pure OCaml threading. Such as, is it pre-emptive or
co-operative? What kind of runtime guarantees can it provide for near
realtime applications, etc.