Project 2 { Memory Management SOlution




What to do.         Implement the Memory module of OSP2.


The project    les are found on the Blackboard in the Assignments section.


Details of what you are supposed to do are given in the OSP2 manual (the chapter on memory management). The additional requirements are:


  1. You have to implement a modi ed 2-handed clock (M2HC) page replacement algorithm similar to (but not exactly) the one described on pages 380-381 in the textbook. You also have to use the dirty-bit optimization (if you do not optimize for clean frames, OSP2 issues warnings, which is not OK and you will lose points).


  1. The M2HC page replacement algorithm works as follows.


  • The rst hand, called the cleaner, sweeps all eligible (for replacement) frames1 at regular intervals of 4000 clock ticks and sets the use bits of these frames to 0.2 To arrange for an asynchronous process to run at regular intervals, use the OSP2 feature called daemon. Read about daemons in the OSP2 manual.


  • At page faults, if no free frame is available, the second hand, called the chooser, sweeps the eligible frames and selects one with the use bit of 0 for replacement. If no such frame exists, choose some eligible frame at will.


  • In addition, the daemon (that runs on behalf of the cleaner hand) should swap out approximately every 10th dirty page it nds.


Your objective in this project is to get your implementation to run under OSP2 without errors and warnings with the parameter les that appear in the Misc subdirectory (the les with the


.osp extension). As explained earlier, occasional errors (every 7-10th run) should not be a cause of concern, if they are unrelated to memory management.


  • You have to gure out which pages are eligible based on your studying of the subject of memory management.


2 You should be able to use the referenced  ag of OSP2 frames as the use bit. Or create your own.

Statistics. Compare and explain your statistics with respect to those produced by Demo.jar. (Demo.jar uses a very simplistic algorithm for page replacement: it scans the entire frame table and chooses the rst replaceable frame.) The statistics of interest are:


The number of pages swapped in and out CPU utilization


Service time per thread (avg turnaround time)


Normalized service time per thread (avg normalized turnaround time)


These statistics are part of the snapshots in the                le OSP.log, which is produced during the runs.


The meaning of these statistics is explained both in the textbook and in the OSP2 manual.



Important notice on the use of Git. You must use Git to maintain your project les and you must make frequent commits to your repository. The Git repository must be in Github classroom. Follow this link to create a repository in this course’s classroom for Project 2:


After a few clicks you will get a repository named cse306-project-2-YourGuthubId. The repos-itory will automatically become private and you should not attempt to change that. Note: this repository is di erent from that of Project 1.


We will be checking your repository and your commit logs to make sure that substantial activity has been taking place over a period of time. If there are less than 5 nontrivial commits, signi cant penalty will apply. Other than that, same requirements to your code as in Project 1.


How to submit. Zip-up your main branch and submit the zip le via Blackboard. Github has a button for that: Clone or download/Download ZIP. Normally, the zip le will have a top folder with a name like cse306-project-2-YourGuthubId-master, but if not then make sure that your submitted zip le has a top folder with such a name. Do not forget to include your name and Student Id in the program source- les. Do not submit paper-based material.


This project is to be done individually. Each source       le must include the following pledge:


I pledge my honor that all parts of this project were done by me individ-ually, without collaboration with anyone, and without consulting external sources that help with similar projects.








error: Content is protected !!