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
[ANN] coThreads 0.10
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-09-17 (21:32)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Re: [ANN] coThreads 0.10
On Mon, 2007-09-17 at 19:51 +0200, Zheng Li wrote:
> skaller <> writes:
> > On Mon, 2007-09-17 at 18:48 +0200, Zheng Li wrote:
> >
> >> * The process engine can give you real speedup on multi-core and
> >>   multi-processor machines, the networker engine (todo) will give you both
> >>   speedup and scalability. 
> > I'm curious how this can be possible**.. is this only with the message
> > passing model? 
> > ** Since Ocaml can't multi-process and neither the compiler
> > nor library are modified ..
> Well, in order to have semantic consistency among different engines without
> modifying standard OCaml itself, shard-memory style concurrency should only be
> achieved through the STM module. It's documented in the pitfall pages: 

Yes but what I'm getting at is the claim of multi-processing,
which Ocaml 3.10 at least cannot do. If you run Ocaml on a multi-core
machine, even if you have 8 cores and 8 threads, one on each core,
only one will ever run at once, so there is no performance gain.
In fact, it will be slower than a single core.

If you are *enforcing* message passing and using separate processes
instead of threads, then 8 processes will run in parallel on 8 cores,
and you'll get roughly 8 times speedup.

So I'm not asking about how to ensure the code is consistent
over the various models, but rather how you can get ANY genuine
concurrency WITHOUT using message passing and processes
(in which case the networking model should be easy to implement)

Whether you explicitly send messages or use transactional memory
or whatever to wrap the message passing isn't the question:
I can see how that can work. However note, the message passing
has to be used for immutable values too, if the threads are
represented by processes in separate address spaces.

John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: