



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




V
IR
G IN
IA
PO
LYTECHNIC IN ST IT U TE
A N D ST A (^) TE (^) UNIVE
RS
IT
Y U (^) TPROSIM
Instructions:
printed
Pledge: On my honor, I have neither given nor received unauthorized aid on this examination.
signed
When a user program calls a system function, the user-accessible function is merely a stub that sets the system into kernel mode and then invokes the trap instruction in order to call the actual system function. The trap instruction searches the trap table for the address of the entry point of the matching actual system function and then issues an unconditional branch to that address.
In general, if a user program could access the trap table directly then it could call protected system functions without first setting the system to kernel mode. In particular, if a user program could modify entries in the trap table it could “hijack” system calls by substituting addresses of user code for those of protected system functions.
The hardware can include a mode bit to distinguish whether privileged code or user code is executing. The mode bit would only be altered via a privileged instruction.
process id id of process owner
process page map process priority
process status registers process data registers
Job CPU Need Wait time Finish time 0 50 20 70
This is straight from the text and lectures.
One advantage is that most processes that are eligible to run will be allocated less physical memory than they would if only real memory were used. That means that more processes can be in the ready-run cycle at once, increasing the potential level of multi-tasking.
Another advantage is that virtual memory makes it possible to execute processes whose address space is much larger than the amount of real memory available in the system.
a) [4 points] What is the maximum number of frames of physical memory that the system could support? Express your answer as a power of 2.
Since the page size equals 2^10, the page offset must be represented using 10 bits. That leaves 22 bits to represent the frame number, and so there cannot be more than 2^22 frames.
b) [8 points] Suppose a process running on this system generated a relative address of 0x12345678. Describe how that would be translated into the proper physical address.
The address is first decomposed into a page number and offset; given the information above, the page number would be 0x12345 and the offset would be 0x678.
The page number must be mapped to a frame number in which the page is actually loaded. (This may require servicing a page fault, but that is not really part of the address translation.)
The frame number is then concatenated with the offset to obtain the proper physical address.