[MLton] More on Parallel Runtime

skaller skaller at users.sourceforge.net
Sat Oct 20 18:50:03 PDT 2007


On Sat, 2007-10-20 at 13:38 -0400, Eric McCorkle wrote:

> The runtime and the program communicate by means of a per-thread  
> mailbox structure.  The actual program is expected to make use of  
> safe-points to periodically check its mailbox, possibly calling into  
> the runtime.  This has two very beneficial effects, I think.  The  
> first is that there are no involuntary context-switches.  

I'm sure that this is just loose language, but context-switches
and pre-emptions are irrelevant, what you really mean is 
synchronisation points.

Context "switching" is merely emulation of concurrency.
Modern processors have multiple physical cores and so
have real concurrency. Posix at least makes it hard to
distinguish threads interleaving by pre-emption and actually
running in parallel, which is certainly deliberate.

The mailbox design, however, should not only work fine
with real concurrency as well as pre-emptive interleaving,
it should scale to processes on separate boxes -- indeed,
Erlang is based on that idea.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net



More information about the MLton mailing list