0% found this document useful (0 votes)
10 views

Page Replacement Algorithm

Uploaded by

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

Page Replacement Algorithm

Uploaded by

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

Tarlac State University

COLLEGE OF COMPUTER STUDIES


OSA – Page Replacement Algorithm

Read the instructions before you start the exam.


 All final answers should be in ink. Multiple answers will not be checked. Cross out all scratch work.
 Only questions pertaining to typographical errors will be entertained.
 Borrowing of writing materials, etc is considered as cheating.
 During the duration of the exam, communication of any form with anybody other than the instructor is considered an act of
cheating.
 Any attempt to cheat is punishable with a grade of 5.0 for the course
Test I - Problem Solving (60 points)

A} Consider the following page reference string

1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6
LRU
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
How many page faults would occur for the
1 3 2 5 2 N 7 3 1 3
following replacement algorithms, assuming one, F
two, three, or even four frames? Remember that
2 4 1 6 1 3 6 2 N 6
all frames are initially empty, so your first unique F
pages will all cost one fault each. (3 pts each)

LRU FIFO
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 3 2 5 2 N 7 3 1 3
F

2 4 1 6 1 3 6 2 N 6
FIFO F
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6

Optimal
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
Optimal
1 3 4 1 5 6 1 3 7 6 3 1 3 6
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
2 N N N N N
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
F F F F F

1 Page Frame # Page faults


 LRU replacement 20 2 Page Frames # Page faults
 FIFO replacement 20  LRU replacement (20-2) 18
 Optimal replacement 20  FIFO replacement (20-2) 18
 Optimal replacement (20-5) 15

NAME : Laurel, Numark Miguel V.


STUDENT TEST SCORE
Year & Section : CS-3B
05-14-2021 INSTRUCTOR /PROFESSOR
Date : (sign if permit is presented) 
Tarlac State University
COLLEGE OF COMPUTER STUDIES
OSA – Page Replacement Algorithm

LRU
LRU 1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6 1 N N 6 N
1 4 5 1 7 2 N F F F
F 2 N N N N N
2 N 6 3 N N F F F F F
F F F 3 5 3 N N
3 1 2 N 6 1 6 F F
F 4 6 7 1

FIFO FIFO
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 4 6 3 N 2 N 6
F F 1 N 5 3 N 1
F F
2 N 1 2 N 7 1
F F 2 N 6 7 3
F
3 5 1 6 3
3 2 N 6 N
F F

4 1 2 N
F

Optimal
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6 Optimal
1 N N 3 N N 1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
F F F F 1 N N 7 1
2 N N N 7 2 N F F
F F F F 2 N N N N N 3
3 4 5 6 1 N 1 3 6 F F F F F
F 3 N N N
F F F

4 5 6 N 2 N
F F

3 Page Frames # Page faults


 LRU replacement (20-5) 15
 FIFO replacement (20-4) 16 4 Page Frames # Page faults
 Optimal replacement (20-9) 11  LRU replacement (20-10) 10
 FIFO replacement (20-6) 14
 Optimal replacement (20-12) 8

-- Nothing Follows --

NAME : Laurel, Numark Miguel V.


STUDENT TEST SCORE
Year & Section : CS-3B
05-14-2021 INSTRUCTOR /PROFESSOR
Date : (sign if permit is presented) 

You might also like