Ask Question, Ask an Expert


Ask Programming Language Expert

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 prepares 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:

• FIFO: First in first out page replacement. See text for description.

• LRU: Least recently used page replacement See text for description.

• OPT: Optimal page replacement. See text for description.

• 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 and fairly. However, because of this "hit-or-miss" approach, RAND is rarely used in practice. 
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

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

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91447

Have any Question? 

Related Questions in Programming Language

Program 1 write a program that asks user to enter a year

Program 1: write a program that asks user to enter a year and this program checks whether that year is leap year or not. Also it should print out all a calendar for the year entered. Starting on Monday Jan 1st, 1900. Cha ...

Complete the below two problems each problem is a separate

Complete the below two problems. Each problem is a separate program (project). Question 1 Write a program that calculates and prints the monthly paycheck for an employee. The net pay is calculated after taking the follow ...

Assignmentafter informing the user what the program does

Assignment After informing the user what the program does, prompt the user for the number of darts to throw. Also, prompt for a number of simulations (why not have the program simulate this dart throwing more than once). ...

Assignemntbulla non-gui based java application that

Assignemnt •A non-GUI based Java application that fulfills the requirements listed below. All output should be to the console/standard output. •Salespersons for Big State Books receive a commission of ten percent for eac ...

Spreadsheet exercise1 run the spreadsheet program in your

Spreadsheet Exercise 1. Run the spreadsheet program in your computer and type the following:   A B C D E F 1 PAYROLL 2 XYZ COMPANY Employee Name Department Degree Salary Need Increase? 3 Nasser Mechanical Master 15000   ...

Program assignment multi-threaded programming in java

Program Assignment: Multi-threaded Programming in Java Using Locks Objectives: To practice programming cooperating, synchronized multiple threads of execution. Description: In this programming assignment you will simulat ...

In this assignment you will write r functions for

In this assignment, you will write R functions for forecasting future values of a time series, and apply them to observations on numbers of deaths and maximum temperatures in Houston, Texas. Doing this will provide more ...

Figure is code to count the number of primes from 2 to n

Figure is code to count the number of primes from 2 to n, using the sieve method on a suitably large array a. That is, a[i] is TRUE at the end only if there is no prime p i or less that evenly divides i. We initialize al ...

Module implementation and support1 how methods of top-down

MODULE: IMPLEMENTATION AND SUPPORT 1) How methods of top-down and bottom-up development can be applied to object-oriented software. 2) Ccommon characteristics of the prototyping, spiral, UP, and XP development approaches ...

Assignmentaverage salary of major league baseball

Assignment Average Salary of Major League Baseball Players Create an application that calculates the average and highest salary of Major League Baseball players in 2011 and 2012. When the user clicks a button, the applic ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

WalMart Identification of theory and critical discussion

Drawing on the prescribed text and/or relevant academic literature, produce a paper which discusses the nature of group

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro