Program to explore page replacement algorithms, Programming Languages

Assignment Help:

Objective: The purpose of this programming project is to explore page replacement algorithms. This can be accomplished by developing a simple simulator that implements various page replacement algorithms and determining the number of page faults for a given reference string. A secondary objective of this assignment is to reinforce good software project design by using multiple source code modules in your solution.

Project Specifications: Develop a simulator program that will enable you to compare and contrast the operation of various page replacement strategies discussed in class (plus an additional page replacement algorithm discussed here). For a given page reference string, your program will output the number of page faults for a given page replacement algorithm. The name of your executable must be "simpager".

Input to your program will be from standard input. There is to be no "user prompts" in your program.

Program output will be to standard output. Your program must follow a standardized input format. The first line is the page reference string. Each number in the page reference string is separated by whitespace and is terminated by a new line. The page reference string is on 1 (one) and only 1 (one) line.

The second line is the number of frames allocated to a specific process. The remaining lines will be string mnemonics; one for each page replacement algorithm.

Output from your program will be the following. Echo the page reference string up to 20 page references per line. Echo the number of frames allocated to the process. Print the page replacement algorithm "mnemonic" and the number of page faults. Although your program reads from standard input and writes to standard output, it is suggested that you have several program data files that you can re-direct standard input and thus have your program read.

The page replacement algorithms and their respective mnemonics to be implemented are the following:

1. FIFO - First in first out page replacement. See text for description.

2. LRU - Least recently used page replacement See text for description.

3. OPT - Optimal page replacement. See text for description.

4. RAND - Random page replacement. This is an easy to implement, low-overhead page replacement strategy. Under this strategy, each page in main memory has an equal likelihood of being selected for replacement. One problem with RAND is that it may accidentally select as the next page to replace the page that will be referenced next. A benefit of RAND is that it makes replacement decisions quickly

 Test your program with this input:

7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1

3

FIFO

LRU

Correct Output:

$ simpager < testcase1.txt

Page Reference String:

7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1

Number of Frames: 3

FIFO: 15

LRU: 12

$

Also, test your program with this input:

1 2 3 4 1 2 5 1 2 3 4 5

3

FIFO

LRU

OPT

RAND


Related Discussions:- Program to explore page replacement algorithms

Draw data structure and analyse on xml, The scenario As an XML expert y...

The scenario As an XML expert you are required to model a system for an online furniture shop. After an interview with the shop manager you have the following information: T

Artificial intelligence, Describe briefly how you might program a computer ...

Describe briefly how you might program a computer to exhibit fear or sorrow.

Shell script to remove colons from a colon–separated record, Normal 0 ...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Software problem program, On December 27, 2011, Seymour Gravel, at the urgi...

On December 27, 2011, Seymour Gravel, at the urging of his wife, Mary Walford, has brought you his preliminary figures for his business. Seymour carries on a business writing and e

Introduction to c#, All programs have to be done in console application. Pr...

All programs have to be done in console application. Program 1, 2 and 3 are due on 2/11/12 Program 4, 5, and 6 are due on 2/18/12 Program 7, 8, and 9 are due on 2/25/12 Program 10

Program to calculate the triangle area, Write a program that will allow the...

Write a program that will allow the user to input the corners of a triangle. The program will draw small yellow circles for each input point, then draw the triangle and calculate t

Improved support for javascript debugging, Improved Support for JavaScript ...

Improved Support for JavaScript Debugging ASP.NET has many benefits over vintage ASP in the place of debugging. You can now quickly debug your server-side value using the complete

Program converts character array to signed decimal integer, 1. Write a func...

1. Write a function that converts a character array to a signed decimal integer. Function prototype must be as follows: int asciiToInt( char *str, unsigned char* eflag) YOU MAY NO

Explain cascading style sheets, Question: (a) In JavaScript, the Windo...

Question: (a) In JavaScript, the Window Object is commonly used to request information from a user or to output some results. Give three ways how to create instances of the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd