Virtual Machine Manager

Virtual Machine Manager (VMM) is the true operating system behind Windows 95. It erects and maintanins the framework for managing virtual machines. It also provides many important services to other VxDs. The three important services are:

Memory Management

VMM uses paging capability of Intel 80386 and later processors to create a 32-bit virtual address space for the system VM. It divides the address space into four distinct areas. VMM provides three types of memory services to VxDs

Interrupt Handling

Interrupts in protected mode vector to Interrupt Descriptor Table (IDT). VMM supervises the IDTs of VMs with the help of VxDs. Normally VMM handles nearly all the entries in IDTs. It provides first-level interrupt handlers which save the state of interrupted program on the stack and transfer control to the second-level interrupt handlers which may be provided by various VxDs for the actual processing. When the second-level handler finishes its job, it transfers control to the redispatch routine which will restore the state of the interrupted program and resume execution at the point of interrupt.
The above description is the oversimplified one. Redispatching may not be immediate because the interrupted VM's timeslice may expire. VxDs can install interrupt handlers via VMM services such as Set_PM_Int or Hook_V86_Int_Chain. VxDs must not modify IDT entries directly (but you can do it if you are sure you know what you're doing)

Thread Scheduling

The VMM uses two scheduler components to implement preemptive multitasking among threads and VMs. Primary scheduler's task is to choose the thread with highest execution priority to run. This selection occurs while the VMM is servicing an interrupt (such as timer interrupts). The outcome determines which thread/VM will be given control when the VMM returns from servicing the interrupt. Primary scheduler works under all-or-nothing rule. Either a thread will be run or it will not. Only one thread is chosen. VMM and other VxDs can boost/adjust execution priority of threads via VMM services. For example, if a hardware interrupt occurs, VMM will boost the interrupt handler's execution priority so that it will have higher chance of completion in the shortest possible time.
Secondary scheduler uses the services of the primary scheduler to allocate CPU time among threads that share the highest execution priority by giving each thread a time slice. When a thread executes until its time slice expires, the secondary scheduler boosts the execution priority of the next thread so that it will be chosen by the primary scheduler to run.

You can get more detail about these subjects from reading Walter Oney's Systems Programming for Windows 95 and the Windows 95 DDK documentation.


[Iczelion's Win32 Assembly Homepage]