[an error occurred while processing this directive]

Lab 5

CS 5631, Spring 2004
Due Tuesday, April 21 (25 points)

First do the following exercise in the lab, then do Lab 5.

Exercise

For Lab 5, you will be writing code in a Java class that represents the memory management subsystem of an operating system. You should not expect to be able to just sit down and start writing code. The code you will write will be just a part of a complex system of classes. To write your part, you will need to understand the interfaces to the other classes and the general organization of the other classes.

The exercise portion of this assignment involves following along with a guided tour of the class documentation. I hope you will also spend more time outside the scheduled lab hour reviewing the documentation. You will find it much easier to write the code if you have a good mental picture of the rest of the system.

Lab 5

Due Tuesday, April 21 (25 points)

What to Implement

For this lab you should complete the implementation of the MemSys class. The only code there right now is skeletons for the interface methods. You will need to implement these methods, along with maintaining any bookkeeping that is needed. Your implementation should use a Not-Recently-Used replacement algorithm with global replacement.

Your code should generate output whenever frames are assigned to processes, written to swap space, or swapped out. You should print the output with the CPU.report() method, which will prefix the report with a timestamp. Your reports should have the following form.

Page fault at page 10 of Process 3.
Dirty page 4 of Process 3 written to swap space from Frame 15.
Frame 15 released by page 4 of Process 3.
Assigned Frame 15 to page 10 of Process 3.
Be sure to use the word "Frame" (upper case first letter), followed by a single space, followed by the frame number. This format is necessary for the execution of a shell script that you will use to generate files that you will turn in.

The code that you are given should have all of the reports that you will need, but you may want to add some for debugging.

Setting Up

The classes that you will need, including a skeleton of the MemSys class, are in the file ~gshute/public/cs5631/lab5.jar. You can unjar it into the directory of your choice.

Running the Simulation

A shell script run is included in the jar file for generating the output that you will need to turn in. You will need to give this file execute permission before using it. Execute the script with the command ./run. This will compile the MemSys class, execute the main() method in the Simulation class, and create three files, out, process3 and frames0-9.

Th out file contains a log of activities reported with the CPU.report() method. The other two files contain log reports for process 3 only or for frames 0 through 9.

For certain errors in your code, you may get a Panic exception. These are also reported in the out file, along with a frame table and a page table display.

What to turn in

You should turn in process3 and frames0-9, along with your code file MemSys.java. [an error occurred while processing this directive]