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

This assignment introduces you to the perl language and cgi

This assignment introduces you to the Perl language and CGI programming. You will use your scripting and html skills to build a Perl program that will gather user input to then generate a personal webpage. This program w ...

Electrical engineering computer methods assignmentq1 write

Electrical Engineering Computer Methods Assignment Q1. Write a program that given the following array, reverses all array elements and then prints them. int x[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Q2. Write a program to d ...

The briefyour small development team of ideally three

The Brief Your small development team of (ideally) three people has been asked to implement and test the Human Resource Information System desktop application. Your software product will be a database- backed desktop app ...

Assignmentthis assignment will be marked out of 100 and

Assignment This assignment will be marked out of 100 and carries 30% of the overall module weighting. Your .java files and report for this part must be uploaded to WebLearn and submitted by 3pm on Wednesday 27th April 20 ...

Programming lab assignment set awhat to submitcomplete

Programming Lab Assignment (Set A) What to Submit Complete Problem Solving Steps 1 - 3 (check plan, data analysis, initial algorithm, and refinement algorithm) for the following programs. 1. (Name: lab1a-1.cpp) Write a p ...

Object oriented system analysis and design1non-functional

Object Oriented System Analysis and Design 1. Non-Functional Requirements a) Analysis of NFRs Analyse the Case Study documents and determine the non-functional requirements (NFRs) or system quality attributes necessary t ...

Programming assignment 1 grocery storethis assignment

Programming Assignment #1: Grocery Store This assignment attempts to serve as a refresher for concepts that I hope you learned in CS 122. In this assignment, you will be building a simple storefront for a small grocery s ...

Write a program that calculates several possible tips to

Write a program that calculates several possible tips to give to a waiter at a restaurant. Ask the user to enter the total cost of the meal and then calculate a tip at 10%, 12.5%, 15%, 17.5%, and 20%. Write the original ...

Engineering programmingi need this now please accurate

Engineering programming I need this now please accurate answers and must be high rated Problem #1 Write a program that asks the user to input the number of miles and convert the miles to kilometers, and then print the ou ...

Consider the following three programswhere i k l are low

Consider the following three programs: where i, k, l are low variables and a, b, c, d, h, n are high variables. Assume db is a database with two columns (shown as array, where the index represents the row), lookup and is ...

  • 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

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate