[MLton] Multicore CPU's and MLton

Stephen Weeks MLton@mlton.org
Tue, 5 Jul 2005 09:11:59 -0700


> Felix uses a linked list of heap objects to represent
> the procedure stack, a context switch is an order 
> of magnitude faster than setjmp/longjmp because it
> can be achieved by a single pointer assignment.
> It was designed for a telephony switch environment,
> to handle 300-600 new threads per second, average life
> three minutes, which works out to around 10-100K threads.
...
> Any bytecode interpreter can do this easily if it 
> is careful to avoid using the machine stack: the machine
> stack is the enemy. See 'Stackless Python' which made a
> trivial tweak to Python so it worked by continuation passing.
...
> Similarly, functional languages based on continuation
> passing are in a good position to provide 
> user space micro-threading.

To be clear, linked-list stacks, bytecode, and continuation passing
are not necessary here.  MLton provides excellent support for
user-space micro-threading with native code and a traditional SSA IL.
MLton does use its own stack (one per thread), not the machine one.
But each stack is a quite traditional monolithic object with mutating
push/pop operations.