[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


B.12 Two-Level Scheduling on OpenVMS Alpha

This section applies to OpenVMS Alpha only. Starting with OpenVMS Alpha Version 7.0, DECthreads implements a new scheduling model, referred to as two-level scheduling. This model is based on the concept of virtual processors. DECthreads schedules threads onto virtual processors similar to the way that OpenVMS schedules processes onto the processors of a multiprocessing machine. From the DECthreads perspective, a scheduled thread is executed on a virtual processor until it blocks or until it exhausts its timeslice quantum. Then, DECthreads schedules a new thread to run. Virtual processors are implemented using the new kernel thread support in the OpenVMS operating system. While DECthreads is scheduling threads onto virtual processors, the OpenVMS scheduler is scheduling virtual processors to run on physical processors. The term "two-level" scheduling is derived from this relationship.

This division provides two major advantages:

First, it allows most thread scheduling to take place completely in User Mode, without the intervention of the OpenVMS scheduler. Since a thread context switch does not involve any privileged information (it is basically just swapping registers), it can be done much more efficiently in User Mode than a context switch involving the operating system.

Second, the two-level scheduling model allows the OpenVMS scheduler to schedule virtual processors onto separate processors of a multiprocessing machine. This allows a process using DECthreads to take advantage of the full resources of a multiprocessor machine.

The key to making the two-level scheduling model work is the upcall. An upcall is a communication mechanism between the OpenVMS scheduler and the DECthreads scheduler. When an event occurs that affects the scheduling of a thread, such as blocking for a system service, the OpenVMS scheduler calls "up" to the DECthreads scheduler to notify it of the change in the thread's status. This upcall gives DECthreads the opportunity to schedule another thread to run on the virtual processor in place of the blocking thread, rather than to allow the virtual processor itself to block, which would deny that resource to other threads in the process. Upcalls are typically arranged in pairs, with an "unblock" upcall corresponding to each "block" upcall. The unblock upcall notifies DECthreads that a previously blocked thread is now eligible to run again. DECthreads then schedules that thread to run point when it is appropriate, given the thread's scheduling policy and priority.



[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]