next up previous
Next: Events Up: The Virtual Processor Interface Previous: The Virtual Processor Interface

Activations

The concept of activations is similar to that presented in [15]. When a domain is allocated the CPU by the kernel, the domain is normally upcalled rather than being resumed at the point where it lost the CPU. This allows the domain to consider scheduling actions as soon as it obtains CPU resource. The exceptional case of a resumption is only used when the domain is operating within a critical section where an activation would be difficult to cope with, entailing re-entrant handlers. The domain controls whether it is activated or resumed by setting or clearing the activation bit in the DCB. This can be considered as disabling the virtual interrupts.

A Nemesis domain is provided with an array of slots in the DCB, each of which can hold a processor context. For example, in the case of the Alpha/AXP implementation, there are 32 slots, each consisting of 31 integer and 31 floating-point registers, plus a program counter and processor status word. At any time, two of the slots are designated by the application as the activation context and resume context.

When a domain is descheduled, its processor context is saved into the activation slot or the resume slot, depending on whether the activation bit is set or not. When the domain is once again scheduled, if its activation bit is clear, the resume context is used; if the activation bit is set, the bit is cleared and an upcall takes place to a routine specified in the DCB. This entry point will typically be a user-level thread scheduler, but domains are also initially entered this way. Figure 3 illustrates the two cases.

 figure260
Figure 3: Deschedules, Activations and Resumptions

The upcall occurs on a dedicated stack (again in the DCB) and delivers information such as current system time, time of last deschedule, reason for upcall (e.g. event notification) and context slot used at last deschedule. Enough information is provided to give the domain a sufficient execution environment to schedule a thread. A threads package will typically use one context slot for each thread and change the designated activation context according to which thread is running. If more threads than slots are required, slots can be used as a cache for thread contexts. The activation bit can be used with appropriate exit checks to allow the thread scheduler to be non-reentrant, and therefore simpler.


next up previous
Next: Events Up: The Virtual Processor Interface Previous: The Virtual Processor Interface

I. Leslie, D. McAuley, R. Black, T. Roscoe, P. Barham, D. Evers, R. Fairbairns & E. Hyden