next up previous
Next: Conclusions Up: Strands Previous: Global Scheduler (trusted)

User Level Schedulers and Strand Packages

The user-level strand model is that the units of execution are managed by two separate entities: a strands package that defines what exactly a unit of execution is, and a strands scheduler that decides when the execution should occur. It is possible that the same module implements both functions, but this clean separation exists to allow incremental changes to either functionality.

User level schedulers are simply a collection of spindles that respond to the Block and Unblock events, and raise the Stop and Run events described above. A user-level scheduler is responsible for setting up the appropriate event handlers for these events with when clauses that match the set of strands it is managing.

Obviously, they are free to export more interfaces than those described. In particular, they will most likely want to export an interface by which clients can register new strands to be scheduled with a particular scheduler. They may also support more exotic features such as lotteries, etc. but no other SPIN subsystem will rely on the existence of such interfaces.

A preemptive user-level scheduler will make use of the Clocktick event, which is raised by spin core at appropriate intervals and has the same signature as the trap event, namely Clocktick(ss: saved_state.T, cause: Causes.T).

A user level strands package responds to the Stop and Run events raised by various schedulers on the strands it is managing, and in turn raises Block and Unblock events to communicate with the schedulers.

Appendix A shows some example code from a user-level strands package and a synchronization module.



Emin Gun Sirer
Sat Jun 22 19:01:37 PDT 1996