Caching and Intro to File Systems

An old Homework problem

Consider a virtual memory system with 32 bit addresses and 8 KB pages. Each page table entry is 2 bytes long, and there is one level of page table. The entire 32 bit address space is available to processes. Consider a process that has allocated the top and bottom 128 MB of its address space. How much memory does its page table use. (Note that 1MB = 1048576 bytes)

Now consider the same process in a two level paging system with the same size pages, but two page identifiers of 10 and 9 bits for the first and second level of the page table. How much memory does this page table consume for the same process?

Answer: The first page table takes the same amount of space for all processes. 8K page tables imply that the offset takes up 13 bits, leaving 19 bits for the page identifier. There are embedded equation two byte entries which is embedded equation bytes (or 1MB).

The second page table requires one main page table of embedded equation 2 byte entries, which takes up 2048 bytes (or 2KB). Each secondary page table addresses embedded equation pages. Because each page is 8K, each secondary page addresses 4194304 (4MB) of data. Each 128 MB of data requires 32 secondary pages for a total of 64 secondary pages each of embedded equation 2 byte entries (1024 bytes). The whole page table takes embedded equation or 68KB. -2-

Another old homework problem: Consider a virtual memory system. This system also has virtual memory hardware cache on the processor. The hit rates and service times for the layers of the memory system are:

Caching level Hit Rate Service Time

CPU Cache 90% 1 ns
Main Memory 75% 1 microsecond
Page Fault (includes translation and retrieval) 100% 10 milliseconds
The layers are tried in order, so a main memory hit only occurs on a cache miss, so a main memory hit is (0.1*0.75) 7.5% of all memory references. What is the average service time of a memory access on this machine? Note that the service time for a layer is paid for a hit or a miss, the time to serve a cache miss that is in main memory is the service time of the cache plus the service time of the memory. The service time must be paid to determine that the item you want is not at this level.

Which improves memory performance more, improving the processor cache service time by 10% (a 0.9 ns lookup time) or increasing the main memory hit rate by 5% (to 80%) by choosing a better page replacement algorithm? Calculate the average memory access time for both changes.

Answer: Absloute rates are:

Caching level Total Hit Rate Service Time

Cache 90% 1 ns
Main Memory (0.1*0.75) = 7.5% 10 ns
Page Fault (0.1*0.25*1) = 2.5% 10 ns
So the average memory access time is
equation
equation
equation
Reducing cache service time to 0.9 ns gives a memory access time of:
equation
equation
equation
Increasing main memory hit rate to 80% gives:
equation
equation
equation
Take the increased hit rate.
Converted from groff by Ted Faber
Please mail me any problems or comments.