Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that implements the FIFO, LRU, and optimal page-replacement algorithms. The program must be a Python script file named Project3.py with 3 functions

Write a program that implements the FIFO, LRU, and optimal page-replacement algorithms. The program must be a Python script file named Project3.py with 3 functions defined within the file. The functions must be named FIFO, LRU and OPT. Each function must take two arguments: the first argument must be the reference string (a Python list), and the second argument must be the maximum number of frames in memory (an integer). Each function must return the number of page faults as an integer. The example below shows the functions being called with a specific reference string and maximum number of frames in memory, with the return values from each function call.

>> ref_str = [7, 0,1,2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1]

>>n = 3

>> FIFO(ref_str, n)

15

>> LRU(ref_str, n)

12

>> OPT(ref_str, n)

9

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_2

Step: 3

blur-text-image_3

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

=+j Explain the relationship between unions and MNEs.

Answered: 1 week ago

Question

=+Have they changed the way employees view IP?

Answered: 1 week ago