0% found this document useful (0 votes)
20 views2 pages

LRU and OPTIMAL

...

Uploaded by

Omkar Rakhonde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

LRU and OPTIMAL

...

Uploaded by

Omkar Rakhonde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

LRU PAGE REPLACEMENT

Consider a reference string as 1,2,3,4,1,2,5,1,2,3,4,5

Find no. of page faults when there are 3 frames. Use LRU algorithm

1 2 3 4 1 2 5 1 2 3 4 5
1 1 1 4 4 4 5 5 5 3 3 3
2 2 2 1 1 1 1 1 1 4 4
3 3 3 2 2 2 2 2 2 5
F F F F F F F H H F F F

No of page faults/ PAGE MISS: 10

No of page hits: 02

Consider a reference string as 2,0,3,0,4,2,3,0,3,2,7,2,0,7,5,0,7,5,7,0

Find no. of page faults when there are 4 frames. Use LRU algorithm

2 0 3 0 4 2 3 0 3 2 7 2 0 7 5 0 7 5 7 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 3 3 3 3 3 3 3 3 3 3 3 5 5 5 5 5 5
4 4 4 4 4 4 7 7 7 7 7 7 7 7 7 7
F F F H F H H H H H F H H H F H H H H H

No of page faults: 06

No of page hits: 14
OPTIMAL PAGE REPLACEMENT

Consider a reference string as 1,2,3,4,1,2,5,1,2,3,4,5

Find no. of page faults when there are 3 frames. Use OPTIMAL page replacement algorithm

1 2 3 4 1 2 5 1 2 3 4 5
1 1 1 1 1 1 1 1 1 3 3 3
2 2 2 2 2 2 2 2 2 4 4
3 4 4 4 5 5 5 5 5 5
F F F F H H F H H F F H

No of page faults/ PAGE MISS: 07

No of page hits: 05

Consider a reference string as 1,2,3,4,2,5,3,4,2,6,7,8,7,9,7,8,2,5,4,9

Find no. of page faults when there are 4 frames. Use OPTIMAL page replacement algorithm

1 2 3 4 2 5 3 4 2 6 7 8 7 9 7 8 2 5 4 9
1 1 1 1 1 5 5 5 5 5 5 5 5 9 9 9 9 9 9 9
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
3 3 3 3 3 3 3 6 7 7 7 7 7 7 7 7 7 7
4 4 4 4 4 4 4 4 8 8 8 8 8 8 5 4 4
F F F F H F H H H F F F H F H H H F F H

No of page faults: 11

No of page hits:09

____________________________________________________________________

Consider a reference string as 2,0,3,0,4,2,3,0,3,2,7,2,0,7,5,0,7,5,7,0

Find no. of page faults when there are 4 frames. Use OPTIMAL page replacement algorithm

2 0 3 0 4 2 3 0 3 2 7 2 0 7 5 0 7 5 7 0

No of page faults:

No of page hits:

You might also like