13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Virtual machines 23A good test of a virtualizing kernel is to let one of its processes be another virtualizingkernel. This arrangement can also be useful to test out a new version of V. However,dangerous operations can be quite slow when there are many levels. The number ofreflections grows exponentially with the number of levels. For example, consider Figure1.11, in which there are two levels of virtualizing kernel, V 1 and V 2 , above which sits anordinary operating system kernel, OS, above which a compiler is running. The compilerexecutes a single service call (marked *) at time 1. As far as the compiler is concerned,OS performs the service and lets the compiler continue (marked c) at time 29. Thedashed line at the level of the compiler indicates the compiler’s perception that noactivity below its level takes place during the interval.From the point of view of OS, a trap occurs at time 8 (marked by a dot on thecontrol-flow line). This trap appears to come directly from the compiler, as shown by thedashed line connecting the compiler at time 1 and the OS at time 8. OS services the trap(marked s). For simplicity, we assume that it needs to perform only one privilegedinstruction (marked p) to service the trap, which it executes at time 9. Lower levels ofsoftware (which OS cannot distinguish from hardware) emulate this instruction, allowingOS to continue at time 21. It then switches context back to the compiler (marked b) attime 22. The dashed line from OS at time 22 to the compiler at time 29 shows the effectof this context switch.The situation is more complicated from the point of view of V 2 . At time 4, itreceives a trap that tells it that its client has executed a privileged instruction while in virtualnon-privileged state. V 2 therefore reflects this trap at time 5 (marked r) back to OS.Later, at time 12, V 2 receives a second trap, this time because its client has executed aprivileged instruction in virtual privileged state. V 2 services this trap by emulating theinstruction itself at time 13. By time 17, the underlying levels allow it to continue, and attime 18 it switches context back to OS. The last trap occurs at time 25, when its clienthas attempted to perform a context switch (which is privileged) when in virtualprivileged state. V 2 services this trap by changing is client to virtual non-privileged stateand switching back to the client at time 26.V 1 has the busiest schedule of all. It reflects traps that arrive at time 2, 10, and 23.Compiler*cOSspcbV2rspcbsbV1rsbrspbsbsrsb051015202530Figure 1.11 Emulating a service call

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!