Chat with us, powered by LiveChat THE SIMULATION CODE YOU ARE BEING PROVIDED WITH A SIMULATION PROGRAM OF A MEMORY MANAGEMENT SYSTEM | Writedemy

THE SIMULATION CODE YOU ARE BEING PROVIDED WITH A SIMULATION PROGRAM OF A MEMORY MANAGEMENT SYSTEM

THE SIMULATION CODE YOU ARE BEING PROVIDED WITH A SIMULATION PROGRAM OF A MEMORY MANAGEMENT SYSTEM

CSI3131 – Lab5 Page Replacement Algorithms (Java) Objectives To use a simulation for evaluating various page replacement algorithms studied in class. Please read the lab document before starting. The Simulation Code You are being provided with a simulation program of a memory management system that consists of the following files (available from the Lab5.zip file). MemManage.java This file contains a number of classes to simulate memory management. MemManage Class The simulation class that creates four process objects (see the Process class) and simulates the execution of the four processes using an arbitrary page replacement algorithm. The selected algorithm is provided as an argument to the class constructor. The possible algorithms are defined as enum PagingAlgorithm { FIFO, LRU, CLOCK, COUNT }. Each process is executed for a random number of memory accesses (varies from process to process). The four processes have the following characteristics: i. PID = 100, Number of virtual pages = 30 ii. PID = 101, Number of virtual pages = 24 iii. PID = 102, Number of virtual pages = 36 iv. PID = 103, Number of virtual pages = 32 The simulation class monitors the number of page faults and at the end outputs the number of page faults per 1000 memory references to allow you to compare the performance of each page replacement algorithm. Process Class This class is used to create process objects. This class is defined in more detail later since you shall be manipulating many of its data structures (for example its page table). Kernel Class One kernel object is instantiated when a MemManage object is instantiated. It provides the kernel specifications. For example an integer array defines the available physical frames. There are 32 physical frames available. You will NOT be manipulating the kernel object. Seeds Class This is used to create a number of seeds used to initialize the various random number generators used in the simulation program. MemManageExp.java This Java program provides a main method to run a simulation for each of the three page replacement algorithms. The simulations are sufficiently long to produce results and can be used to compare the performance of the three page replacement algorithms. Note that the resulting output should be on the order of 50 to 60 page faults per 1000 memory references. FifoExp.java ClockExp.java LruExp.java CountExp.java: Each of these Java programs contains a main method for executing a simulation object for each of the page replacement algorithms. They run the simulation for a very short period and do not produce valid results. They are provided for your convenience to allow you to debug your code (if you debug using logging, then the short runs produces manageable output) separately for each page replacement algorithm. KernelFunctions.java This Java program contains the class KernelFunctions which provides the necessary methods for page replacement. The MemManage class invokes two methods: – doneMemAccess each time a memory access is completed and – pageReplacement each time a page Fault occurs. You will be completing the methods in this class. Also found in this Java file is the class PgTblEntry specifying the format of the page table entries (and used to create the page table). JAR Files colt.jar – see https://en.wikipedia.org/wiki/Colt_(libraries) This file contains the various classes for creating various random number generators used in the simulation program. Be sure to include this file in “classpath”. Use the following command to browse the contents of the colt library: jar tf colt.jar See https://en.wikipedia.org/wiki/Colt_(libraries) for more details. Note, you don’t need to fully understand the library to finish your task. abcmod.jar This file contains the various classes that provide simulation functionality. For example, notice that MemManage is extends the EvSched class, an event scheduling simulation class. Be sure to include this file in “classpath” (or imported into your favourite Java development tool). Use the following command to browse the contents of the abcmod library: jar tf abcmod.jar Running Simulation To compile the provided code, first create a bin directory to store all class files, then use the following command: javac -cp “.;abcmod.jar;colt.jar” -d bin *.java To run the simulation use the following command: java -cp “bin;colt.jar;abcmod.jar” MemManageExp | tee sim.txt The simulation runs four page replacement algorithms in sequence and displays the page-fault rate of each algorithm. Three of the four algorithms have been stubbed. Your task is to fill the functionality to compare the 4 algorithms. Tasks Part A During the first week, take the time to study the code provided and to understand how the Process class is organized. Many of the concepts shall be presented during a lecture following the first lab session. Try to review the course notes and text book to understand terms such as working sets, page faults, page replacement algorithms, etc. Compile and run the code to test out the FIFO page replacement algorithm. If you have time try to understand one of the algorithms LRU or Clock and implement. Part B Complete the KernelFunctions class to implement and compare the three page replacement algorithms. – FIFO algorithm is provided for you as an example – CLOCK algorithm is very similar to FIFO, but use a flag (used) to give a second chance to recently used pages – Least Recently Used (LRU) algorithm requires a time stamp of pages used and picks the least recently used page to replace – COUNT based algorithms uses requires a count of page access, least frequently used algorithm replace the page with the least count Your results should show that LRU has the best performance (least number of page faults per 1000) followed by CLOCK, and finally that FIFO has the poorest performance (most page faults per 1000). My simulation shows that the count-based algorithm is even worse than FIFO. Here is a typical result: Running simulation using FIFO Number of faults: 158107 Number memory accesses (no faults): 2663272 Number of faults per 1000 references: 56 Running simulation using CLOCK Number of faults: 155756 Number memory accesses (no faults): 2781233 Number of faults per 1000 references: 53 Running simulation using LRU Number of faults: 151391 Number memory accesses (no faults): 2958343 Number of faults per 1000 references: 48 Running simulation using COUNT Number of faults: 193146 Number memory accesses (no faults): 558934 Number of faults per 1000 references: 256 HINT: – use the doneMemAccess function to update page table entry aspects you need to maintain, e.g. timestamp & used flag. – Add a count field to the table-entry class to use in count-based algorithm. Also use doneMemAccess to maintain the count.

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Writedemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order