Operating Systems: HW 2

Due Nov 6, 2013


Answer each of the following questions. Please submit your solution through Moodle.

1. (10 points) Does paging help with internal fragmentation, external fragmentation, or both? How does it help?

2. (5 points) Why does paging require the use of virtual addresses?

3. (10 points) Describe the hardware that most systems provide to improve the performance of address translation.

4. (15 points) Consider a system with 32Byte pages/frames and a total memory size of 512Bytes. Assume it is a typical 32bit system and thus can access memory with 4 byte (word level) granularity. CLARIFICATION: This means that memory can only be addressed at word level granularity--thus an offset of 0 within a page implies the first word (e.g. bytes 0 to 3) of the page, while an offset of 1 refers to the second word (bytes 4-7). As a result, the 512B of memory only needs addresses for 128 words (512/4).

(a.) In each virtual address on this system, how many bits are needed for the page number (p) and how many for the offset (d)?

(b.) Use the above information and the following page table to translate virtual address "31" to a physical address.


To receive any partial credit, show the following: values of p and d, the frame number corresponding to p, the fully translated address.
Hint: to verify your methodology, you can check that virtual address 12 maps to physical address byte 208 (frame 6, offset 4th word).

5. (10 points) Describe segmented paging and list two benefits and one drawback associated with it.

6. (10 points) Why is demand paging beneficial? What are the added costs of supporting demand paging?

7. (10 points) What is locality of reference? How does it impact systems that swap pages to disk?

8. (30 points) Determine how the FIFO, LRU, and MIN page replacement schemes would each handle the following page access pattern. Assume that the system has three frames (F1, F2, and F3), and that each frame can hold a single virtual page (A, B, C, D, or E). Fill in how the frames are mapped for the following access stream, and report the number of page hits for each algorithm.

FIFO A B C D E A C E D C E A
F1
F2
F3
Number of hits:

LRU A B C D E A C E D C E A
F1
F2
F3
Number of hits:

MIN A B C D E A C E D C E A
F1
F2
F3
Number of hits:

Prashant Shenoy