[MLton] More on parallelism

skaller skaller at users.sourceforge.net
Tue Dec 5 09:46:54 PST 2006


On Wed, 2006-12-06 at 04:22 +1100, skaller wrote:
> On Tue, 2006-12-05 at 11:42 -0500, Matthew Fluet wrote:

> In many applications you need to know the difference
> between these kinds of threads, even if you have a
> common abstraction that allows some code to work with
> either kind, in general this won't be the case.

I should give an example: in a telco application one needs
load balanced call monitoring. The number of threads exceeds
100K -- one for each current call. The context switching
times required are extreme, as is thread creation time:
a switch can handle roughly 600 calls/second.

Typically these threads do not communicate -- each phone
call is independent. New calls are routed to one of the
per-CPU worker threads in an attempt to balance the load
to maximise throughput.

This is also how a web server *should* operate. 
Other applications include GUIs, games, simulations,
and just about any kind of cellular automata.

In all these cases the low and high level dispatching
requires quite different algorithms. 

A simple example -- in a telco, a conference call
programmed cooperatively requires the fibres to
run on the same CPU, so the high level system may
have to organise moving a fibre to a different CPU.

A obvious and more extreme example is mobile phone handling,
where you're migrating calls across a network.

The system I worked on provided an abstraction layer
where all of this was transparent -- underneath of course
making it work required quite distinct codes for the different
kinds of threads of control. Traditional telephony uses
a shared memory model .. even across a network.


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



More information about the MLton mailing list