Discussion questions: memory management 1

Please work out these problems before your next discussion section. The GSIs will go over these problems during the discussion section.

1. Page addressing

Consider a system with 32-bit addressing and 4-KB pages.

a. How many bits are needed to represent the offset? Which bits of the address are these? (bit 31 is the most-significant, bit 0 is the least-significant).

b. How many bits are needed to represent the page number? Which bits of the address are these?

c. What is the greatest number of virtual pages a process could address?

d. Repeat (a), (b), and (c), assuming now that the system changes to using 16-KB pages.

2. Second-chance Clock with FIFO

Assume the clock queue contains the following resident pages:

                         3
                      5     7
                    6         0
                      1     2
                         4

The hand currently points at page 5. The referenced bits are currently as follows:
Page # Referenced
0 T
1 F
2 T
3 T
4 F
5 T
6 F
7 T

a. If the OS needs to evict a frame, which one will it choose, given this clock queue, hand position, and reference bits?

b. List the hand position and reference bits for each page after the eviction. Don't worry about inserting any new page into the clock queue.