Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The primary goal for the project is to implement and experiment with page replacement algorithms. To do this, you will write a paging simulator. It

The primary goal for the project is to implement and experiment with page replacement algorithms. To do this, you will write a paging simulator. It will read in a set of data files specifying the page traces for individual jobs and will need to simulate the paging requirements of those programs. The trace file could also be generated using a random number generator that produces random page numbers for each job. The value of each number is within the size of the program (address space) which we assume given. We assume that the processes are run Round Robin and that the rate of page generation is steady/fixed and that the number of memory accesses for a job is proportional to its length, which is given at the start. So a job with 2 hours duration generates double the memory traces of the job of one hour and half the traces of a job of 4 hours duration. The process duration is given at the start or generated randomly (between 1 and 10 hours only). Implementation requirements a) You will be given a configuration file containing 1. The number of processes (degree of multiprogramming) 2. The size of physical memory in frames 3. The minimum frames per process 4. The id ,size in pages , start time and duration for each process 5. the page traces for each process b) You need to simulate each process behavior in separate thread c) The memory management system will also have a separate thread d) The physical memory will be represented by a shared memory block between all threads (part of this memory should be used for the page tables) e) Each page will be represented in the shared memory by 4 byte , 2 bytes contain the process id and 2 bytes for the page id f) Synchronization should be used to prevent more than one thread of accessing the same memory reference simultaneously (e.g when memory management thread updating page table should not allow other threads to access that page table till update is done ) g) You have the freedom to decide how to implement other details like how to simulate a page fault, how notify the process that the page fault was served and scheduling implementation. Configuration file Format N // number of processes M // size of physical memory in frames S // minimum frames per process PID start Duration Size memory traces (e.g. 10 13 1A 3B ,) // a line for each process (N lines total) Memory Traces Memory trace is a list of addresses accessed by a program in Hexadecimal. The addresses are truncated to virtual page numbers by removing the lower 12 bits (assuming which page size??), which makes the files smaller. The process size limitation needs to be observed Scheduling You will need to simulate a simple scheduling algorithm that allows programs to alternate running. For this project, you only need implement round robin between runnable processes with fixed time Quantum. The simulator defines the quantum through the number of references seen (a clear approximation). Your scheduler will keep track of the current time in terms of cycles, where a cycle is one memory reference in the memory trace. If needed you can assume 1000 cycles in a second. Context switching should take 5 cycles. After a context switch, you should start simulating memory references from where you left off. The scheduler should report elapsed time (time between when it started and when it completed) for each process. In addition, at the end of the simulation (when all processes have completed), it should report the TA (Turnaround) and W (wait) for the processes. You should experiment with different quantum values. Page Replacement Your simulated machine will have a fixed number of frames (physical pages) to share between running processes. When the memory required exceeds the available physical memory, you will need to use disk storage. You need to keep track of which pages are in physical memory and which are on disk. It takes 300 cycles to move a page from disk to memory. Moving pages from memory to disk is free, as this can be overlapped with computation. For each cycle that process executes, you should check whether the virtual page is in physical memory. If so, advance to the next address. If it is not in physical memory, you must simulate a page fault by: 1. Context switching to a new process 2. Putting the current process on a blocked queue 3. Reading the page off disk 4. Making the process ready again when the page comes back off disk You must keep track, for each process, which pages are in physical memory and which are on disk. Assume that all pages start off on disk and you are doing demand paging. Because writing pages to disk is free, you don't have to worry about whether a page is dirty or not (and in fact, the trace does not indicate whether a memory reference is a read or a write). Report the number of page faults experienced by each process and the total number of page faults experienced across all processes. You should experiment with total physical memory sizes of 40 pages, 200 pages, and 500 pages. Page replacement policies You should simulate 2 different page replacement policies, the odd ones in the list below (1,3) or the even ones in the list below (2,4) based on the max value of the first digit of the team ID numbers, again: 1. FIFO 2. Second-chance FIFO 3. LRU 4. Clock

I need the LRU algorithm do not answer with fifo algorithm

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions