Keeping track of the threads, and processing them in order, is easy with a queue. To illustrate this, we present a simple timer interrupt handler which does all of the above. For humor value, it introduces some randomness into the duration of each quantum. With this simple model, it is now easy to express a variety of paradigms. Add fork and suicide .
Threads lie at the heart of most modern operating system execution models.
Our interpreter-based approach makes it easy to explore a host of such approaches. It is important to note that threads introduce numerous difficulties if the language also includes mutation.