Question
Consider now a recursively virtualized system based on the Popek/Goldberg machine model. For this exercise, assume that a classic VM monitor (VMM1) runs on top
Consider now a recursively virtualized system based on the Popek/Goldberg machine model.
For this exercise, assume that a classic VM monitor (VMM1) runs on top of the physical machine, and VMM1 manages a single virtual machine (VM1). Within VM1 runs another classic virtual machine monitor (VMM2), and VMM2 manages a single virtual machine VM2. The O/S and application App run on VM2. Assume two modes of privilege of the CPU (U=user, S=supervisor).
Assume each VM has a single VCPU, and that each VM is allocated a contiguous region of memory (all starting addresses below represent hardware physical addresses). Assume the application App occupies the top 200 words of VM2s memory. Please refer to Figure 1 for a graphical representation.
Physical machine: lower address: 0, size: 500 words
VM1: lower address: 100; size: 400 words
VM2: lower address: 200; size: 300 words
Assume the system call entry instruction SYS is defined in the ISA as a non-privileged instruction that follows the same trap behavior as described in the Popek/Goldberg paper (the PSW consists of PC, mode, and relocation register):
Store PSW into memory using physical address 0
Load PSW from memory using physical address 1
Assume that a return from syscall (RETSYS) is a privileged instruction that traps if in user mode, or loads the PSW from memory address 0 if in supervisor mode. Also, assume that all VMMs use address 2 to store the PSW of the virtual CPU of the VM they manage, and that all VMMs and kernel use a starting address 3 for their trap handler routine.
1) Determine the initial-condition contents stored in all physical memory/register locations with question marks in Figure 1, at the point when a SYS instruction is issued by the application running on VM2. If a value cannot be determined, represent it with an x. Assume the initial value of the physical PC is 100 (note that all memory references are relative to the relocation register RR).
2) Describe step-by-step what takes place during emulation of SYS starting from this state from the time it is issued by App to the time the O/S kernel begins to execute. Begin by specifying the initial privileged state of the physical and virtual CPUs, then record any time there is a change in privilege mode of any physical/virtual CPU, or the physical PC, or relocation register RR. State any assumptions that you make and comment on what happens during the handling of each event at the different modules of the system. If a value cannot be determined, represent it with an x. Use the following format in your answer (Hint: the bookkeeping when following events can be tricky; it is recommended that you use Figure 1 as a template, work out step by step the state transitions, and record changes in the template given by Table 1):
Table 1: template for solution of question 2)
Event | PC | RR | PCPU | VCPU1 | VCPU2 | Brief comment on which layer (App, O/S kernel, VMM2, VMM1) handles event and what causes a change in state |
Initial state |
|
|
|
|
|
|
SYS |
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
3) For each scenario below, a snapshot of PSWs for PCPU, VCPU1 and VCPU2 are shown the format is [PC,Mode,RR]. For each snapshot, determine if it is a feasible state for the system, or not. If it is feasible, describe from which code (VMM1, VMM2, O/S, or App) the next instruction is fetched; if it is not feasible, explain why.
i) PCPU: [80,s,(0,500)]
VCPU1: [80,s,(0,400)]
VCPU2: [90,u,(100,200)]
ii) PCPU: [350,u,(0,500)]
VCPU1: [250,u,(0,400)]
VCPU2: [150,u,(100,200)]
iii) PCPU: [80,u,(200,300)]
VCPU1: [80,u,(100,300)]
VCPU2: [80,s,(0,300)]
iv) PCPU: [50,s,(0,500)]
VCPU1: [150,u,(100,400)]
VCPU2: [50,s,(200,300)]
Figure 1: diagram showing memory location of VM1, VM2, and App
Figure 1: diagram showing memory location of VM1, VM2, and AppStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started