[MLton] threads and traces

Stephen Weeks MLton@mlton.org
Tue, 13 Jul 2004 16:21:17 -0700

> That's true.  MLton doesn't impose any particular scheduler on threads.
> You can easily code up a non-preemptive scheduler.  A preemptive scheduler
> generally needs signals and the OSs signals.

As mentioned in the user guide, have a look at thread1.sml, which
implements non-preemptive threads, and thread2.sml, which implements
pre-emptive threads.

> You might be able to get by with a scheduler that gets runs based on
> a GC signal

This wouldn't be fair, because a thread with a loop that does no
allocation could starve all other threads.  So, it's probably better
to go with time-based preemption.