Question

In: Computer Science

Consider the following page reference string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0,...

Consider the following page reference string:

0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

How many page faults would occur for the following replacement algorithms, assuming one, three, five, and seven frames? Remember that all frames are initially empty, so your first unique pages will cost one fault each.

  • Optimal replacement
  • LRU replacement
  • CLOCK replacement
  • FIFO replacement

Solutions

Expert Solution

One frame:

Optimal replacement:

string:

No of page faults = 20

LRU replacement :

string:

No of page faults = 20

CLOCK replacement

string:

No of page faults = 20

FIFO replacement

string:

No of page faults = 20

Three frames:

Optimal replacement:

string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

0         0    0    0   2   2   2   2 2

1         1    1    1   1   6   1   1   1

2         3    4    5   5   5   5   0   5

No of page faults =11

LRU replacement :

string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

0   3   3   4   4   4 0 0   6   6   1   1   1

1   1   1   1   5   5 5 2   2   2   2   2    2

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

No of page faults = 15

CLOCK replacement :

string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

0   3 3 4 4 4 0 0 6   6 6   1 1   1

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

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

No of page faults = 16

FIFO replacement

string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

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

1 1 0 0 0 1 1 1 6 6 6 0 0   0

2 2 2 4 4 4 0 0 0 5 5 5   2 2

No of page faults = 16

Five frames:

Optimal replacement:

string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

0 0 0

1 1 1

2 2 2

3 5 5

4 4 6

No of page faults = 7

LRU replacement :

string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

0 0 0 0

1 1 1 1

2 5 5 5

3 3 2 2

4 4 4 6

No of page faults = 8

CLOCK replacement :

string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

0 0 0 0

1 1 1 1

2 5 5 5

3 3 2 2

4 4 4 6

No of page faults = 8

FIFO replacement

string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

0 5 5 5 5 5

1 1 0 0 0 0

2 2 2 1 1 1

3 3 3 3 2 2

4 4 4 4 4 6

No of page faults = 10

Seven frames:

Optimal replacement:

string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

0

1

2

3

4

5

6

No of page faults = 7

LRU replacement :

string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

0

1

2

3

4

5

6

No of page faults = 7

CLOCK replacement :

string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

0

1

2

3

4

5

6

No of page faults = 7

FIFO replacement

string : 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5

0

1

2

3

4

5

6

No of page faults = 7


Related Solutions

Consider the following page reference string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0,...
Consider the following page reference string: 0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5 How many page faults would occur for the following replacement algorithms, assuming one, three, five, and seven frames? Remember that all frames are initially empty, so your first unique pages will cost one fault each. Optimal replacement LRU replacement CLOCK replacement FIFO replacement
Consider the following page reference string:5, 1, 5, 5, 3, 6, 2, 3, 0 , 7,...
Consider the following page reference string:5, 1, 5, 5, 3, 6, 2, 3, 0 , 7, 2, 5, 2, 1, 7, 2, 3, 1, 4, 6.Assuming demand paging with three frames, how many page faults would occur for the following replacement algorithms?• LRU replacement• FIFO replacement• Optimal replacement
The following page-reference string: 1, 2, 4, 3, 2, 5, 4, 2, 4, 2, 1, 3,...
The following page-reference string: 1, 2, 4, 3, 2, 5, 4, 2, 4, 2, 1, 3, 2, 3, 1, 3, 6, 1, 6, 4. Main memory with 3 frames of 1 kilobyte available and they are all initially empty. Complete a figure, similar to Figure 8.14(in the slides or textbook), showing the frame allocation for each of the following page replacement policies: a. Optimal b. Least recently used c. First-in-first-out Then, find the relative performance of each policy with respect...
Consider the following reference string: 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0,...
Consider the following reference string: 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Find the number of Page Faults with FIFO, Optimal Page Replacement, and LRU with four free frames that are initially empty. Which algorithm gives the minimum number of page faults?
Consider the following virtual page reference sequence: page 1, 2, 3, 4, 2, 1, 5, 6,...
Consider the following virtual page reference sequence: page 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3. This indicates that these particular pages need to be accessed by the computer in the order shown. Consider each of the following 4 algorithm-frame combinations: LRU with 3 frames FIFO with 3 frames LRU with 4 frames FIFO with 4 frames Print a copy of this page. For each of the 4 combinations, below, move from left to right as...
Find LRU paging A program has the following page reference string 0 1 2 3 3...
Find LRU paging A program has the following page reference string 0 1 2 3 3 4 2 4 5 3 3 4 6 2 5 6 If we allocate 3 page frames to the program, 1. Please draw a figure to show the page allocation/replacement. 2. How many page faults will be generated?
Page Replacement Algorithms. Consider the following page reference stream and 3 page frames: 0 1 2...
Page Replacement Algorithms. Consider the following page reference stream and 3 page frames: 0 1 2 3 2 4 3 1 1 5 2 4 6 3 3 4 6 3 4 7. For the MIN, FIFO, and LRU algorithms, show the contents of the page frame after each reference, and then compute the total number of page faults, divided in to cold misses and other misses.
Consider the following string of page references: 5, 7, 8,9, 7, 3, 7, 4, 9, 3,...
Consider the following string of page references: 5, 7, 8,9, 7, 3, 7, 4, 9, 3, 7, 3, 9. showing the frame allocation for: a. Optimal b. LRU (least recently used) c. FIFO (first-in-first-out) d. List the total number of page faults for each policy. Count page faults only after all frames have been initialized.
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6...
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6 1 5 6 8 2 4 6 7 3 4 5 9 10 5 8 9 4 7 9 6 7 8 6 How can I detect when 'cin' starts reading from a new line. The amount of numbers in each row is unknown. I need them in type 'int' to use the data.
Given the following dataset x   1   1   2   3   4   5 y   0   2   4   5  ...
Given the following dataset x   1   1   2   3   4   5 y   0   2   4   5   5   3 We want to test the claim that there is a correlation between xand y. The level of cretaine phosphokinase (CPK) in blood samples measures the amount of muscle damage for athletes. At Jock State University, the level of CPK was determined for each of 25 football players and 15 soccer players before and after practice. The two groups of athletes are trained...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT