System Architecture

(INFT12-212 and 72-212)
Lab Notes for Week 10: Virtual Memory Management

1  Introduction

Unfortunately, there are no system calls which are related to virtual memory management. In fact, the Linux system generally just gets on with things here, using page replacement algorithms like LRU or similar to look after things.
If you can think of anything I can put in here, please let me know.
We can play with tools like top, vmstat and friends which can help you visualise the VM statistics of your system.

2  Memory Management Simulator

On the Modern Operating System Simulators web page, there is a memory management simulator for Linux. Install the program on your Debian box in the Linux Lab. This should be as simple as: Once you have the memory management simulator installed and working, read the user manual. The simulator allows you to set up some physical memory, make a virtual address space and map it to (some of) the physical memory, and to simulate reads and writes to address space locations.

Activities

  1. Using the supplied memory.conf and commands file, try to determine by hand:
    1. which pages will be read from
    2. which pages will be written to
    3. which page has the oldest lastTouchTime.
    Run the simulation and see if your deductions were correct.
  2. What page replacement policy does the simulator use? Read the Java source code to find out.
  3. Create a command file that maps any 8 pages of physical memory to the first 8 pages of virtual memory, and then reads from one virtual memory address on each of the 64 virtual pages. Step through the simulator one operation at a time and see if you can predict which virtual memory addresses cause page faults.
  4. Create a command file that has a whole bunch of lines like this:
    READ random 
    WRITE random 
    READ random 
    WRITE random 
    READ random 
    WRITE random
    
    
    The memory.conf file sets up an address space of 64 pages and 32 page frames. Run the simulator with these file. Why does page 0 get moved, then page 1, then page 2 etc.? Given the command file, what do you think the probability of a page fault will be for any memory access?
  5. For the Java programmers, modify the simulator to do LRU page replacement instead of its default. Now write a command file that has a few hundred READ operations in the range hex 0000 to hex C000 (which will try to access half of the unmapped pages).
    Run the simulator with the command file before the modification and after the LRU modification. You should see a reduction in the number of page faults.

3  Outlook for the Next Lab

In the next lab, we will look at files and filesystems.


File translated from TEX by TTH, version 3.85.
On 13 Jan 2012, 11:38.