Wap to simulate the lru page replacement algorithm

Assignment Help Basic Computer Science
Reference no: EM131593175

Question: Virtual Memory

Write a program to simulate the Least-Recently-Used (LRU) Page Replacement Algorithm that appears on page 366 of the textbook. In particular, the simulator should accept the following input from standard input (stdin):

Number of Virtual Pages
Number of Page Frames Available (not used by page table)
Number of References
Page Referenced Read or Write (0 or 1, respectively) duration
Page Referenced Read or Write (0 or 1, respectively) duration
            :            :

For example:

5
3
2
0 0 2
1 1 1
3 0 1

is valid input. There are 5 virtual pages (numbered 0, 1, ... 4), 3 page frames (numbered 0, 1, 2) in memory, 3 references listed: page 0 is read from for 2 clock ticks, page 1 is written to for 1 clock tick, and page 3 is read from for 1 clock tick.

Maintain a page table as an array. Use page number as an index to the array. The array should include an R-bit, an M-bit, and a Present/Absent bit, as well as the frame currently mapped.

R-bit = 1 if page has been referenced recently (read/write)
M-bit = 1 if page has been modified (needs to be written to disk)

Corresponding to the previous example, the page table could look like this way:

1 0 1 0
1 1 1 1
0 0 0 0
1 0 1 2
0 0 0 0

The first row indicates the virtual page 0 is mapped to the physical page 0. The page has been referenced and is present in the physical memory.

Assume that the R-bit is reset to 0 after a set of 6 pages have been referenced. This is to simulate a reset after each clock interrupt.

The output from the simulator should indicate whenever a fault occurs, and which page has been evicted (if one is evicted). Always select the smallest numbered page in a class to be evicted. In addition, the output should include the total number of faults that occurred.

The possible output would look something like:

: :
Fault: no page evicted, page 0 brought in to memory.
Fault: page 2 evicted, page 3 brought in to memory.
: :
Total number of faults is 23.


What to Hand In:

All programing files. (whole project solution).

Reference no: EM131593175

Questions Cloud

What is the present value added assuming : What is the present value added assuming a 10% rate?
What expected rate of return would security earn : What expected rate of return would a security earn if it had a .36 correlation with the market portfolio and a standard deviation of 54.1 percent?
What expected rate of return would security earn : What expected rate of return would a security earn if it had a .36 correlation with the market portfolio and a standard deviation of 54.1 percent?
Planning and strategic management panera bread co : Co nsidering a SWOT Analysis, what strengths and opportunities exist for Panera? What weaknesses and threats exist?
Wap to simulate the lru page replacement algorithm : Write a program to simulate the Least-Recently-Used (LRU) Page Replacement Algorithm that appears on page 366 of the textbook.
What rate of return will the man receive : A man buys a corporate bond from a bond brokerage house for $925. what rate of return will the man receive?
Evaluate the stopping by woods on a snowy evening : Robert Frost is clearly one of the best poets ever. Three of his most famous poems, Stopping by Woods on a Snowy Evening, The Road not Taken
Calculate the cash dividend per share : Calculate the cash dividend per share for 2017 and the dividend yield based on the market price calculated in part e
What is price of the bond : Its current yield is 7.5 percent and its yield to maturity is 10 percent. What is the price of the bond?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  How to configure the mobile device settings

Make a document demonstrating how to configure the mobile device settings (APPLE iPhone) as follows taking screenshots to demonstrate knowledge:

  Cybersquatting collapse

Local challenges Collapse . What are the issues and challenges facing your country regarding information security, spam, Internet governance and data? How would you approach a solution to the problem?

  How could crm and prm systems help solve this problem

Mercedes did not force dealers to report this information. There was no real incentive for dealers to share information with the company. How could CRM and PRM systems help solve this problem?

  Advantages of control structures with arrays

Describe some of the advantages of using repetition control structures with arrays. Provide an example to support your stated advantage.

  Simple algorithm to find all prime numbers

Eratosthenes sieve The Eratosthenes sieve is a simple algorithm to find all prime numbers less than a given number.

  Define a class to hold multiple values in a hash-table

Implement a data structure, which can quickly do the following two operations: add an element and extract the smallest element. The structure should accept adding duplicated elements.

  Create a java program

Using arrays create a java program were a company that pays its sales staff on a commission basis. Each employee receives $500 per week plus 6.5% of their sales. For example, a salesperson who sells $10,000 worth of products will get a salary of 5..

  Analogies describe complex subjects in a more meaningful

Analogies describe complex subjects in a more meaningful and understandable way. This CheckPoint provides an opportunity for you to describe principles of radio wave transmission using original analogies. Consider the following example analogies:A co..

  Find the order of all elements of the multiplicative groups

If you want to refresh your mental arithmetic skills, try not to use a calculator whenever possible, in particular for the first two groups

  Specify the time required for the reoptimization

Specify an O(nm) algorithm for solving the maximum multiplier path problem for networks that contain no positive mUltiplier directed cycles.

  Create a budget for a church with an appealing format that w

Using Excel, create a budget for a church with an appealing format that will identify the income/expenses of the church. This can be a yearly budget or a monthly budget (or both). Include relevant categories, formulas, and appropriate formatting choi..

  Estimate the required surface area

If the overall heat transfer coefficient is 200 W/m2 . K, estimate the required surface area.

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