SPRING 2004 OPERATING SYSTEMS COMPREHENSIVE EXAM
You must answer ALL questions. Each solution should go in a separate blue book.
1. Consider a stream that has six stepping stones across it. To cross the stream, a
person puts one foot on the stone closest to her bank. Then, she puts her other foot
on the second stone in sequence. She proceeds walking across the stones in this
manner until she is on the other bank.
The stones are small - no more than one foot can be on a stone at a time.
a) Show that deadlock is possible in this system.
b) Give a simple condition that is true iff the system is deadlocked.
c) Consider using the Banker's algorithm to avoid deadlock. Give a simple
description of how the executions it allows avoid deadlock. In particular, describe
one execution in which there was no danger of deadlock but the Banker's algorithm
did not allow it to happen.
2. This problem is on Virtual Memory.
(a) Let's do some bit masking as warmup. Given a 17-bit virtual address space and
a page size of 128 bytes, what is the virtual page number of the virtual address
0x54FA? What is the offset?
A fundamental mechanism in modern virtual memory architectures is the
translation lookaside buffer (TLB).
(b) What does the TLB translate? What is the input and what is the output? What
does the TLB store as entries?
(c) When does a translation miss in the TLB, and, briefly, what needs to happen for
the TLB to resolve the miss?
(d) What is the difference between a hardware-managed TLB and a software-
managed TLB? What are the tradeoffs of one versus the other?
(e) Modern architectures with 64-bit virtual address spaces require new
innovations for page tables to represent and map such vast address spaces. Does
the TLB need to drastically change as well? What, if any, are the performance
implications of using a TLB with the same number of entries on a 32-bit architecture
versus a 64-bit architecture? Why? You can assume that applications on the 64-
bit architectures have orders of magnitude larger virtual address spaces than those
on the 32-bit architectures.