282 views
1 votes
1 votes
On a demand paged virtual memory system running on a computer system that
has main memory size of 4 page frames which are initially empty.The system access the pages (A1,A2,....,A20) pages in order.

what is the difference between the number of page faults if
a). system again access the pages from(A1,A2...,A20) in the same order

b) system again  access the pages from(A1,A2...,A20) in the reverse order

page replacement policy is optimal page replacement policy.

difference is to be calculated  between the two cases a) and b)

1 Answer

Best answer
1 votes
1 votes

 a)

      a4 a5 a6   a20 a20 a20 a20 a20 a20   a20
    a3 a3 a3 a3   a3 a3 a3 a3 a3 a3   a18
  a2 a2 a2 a2 a2   a2 a2 a2 a2 a2 a5   a17
a1 a1 a1 a1 a1 a1   a1 a1 a1 a1 a4 a4   a19
F F F F F F .............. F H H H F F ................ H

First Access = 20  Faults (F)

Second Access in same order =16 Faults

b)

      a4 a4 a4 a4 a8   a20 a20 a20 a20 a20    
    a3 a3 a3 a3 a7 a7   a19 a19 a19 a19 a19    
  a2 a2 a2 a2 a6 a6 a6   a18 a18 a18 a18 a18    
a1 a1 a1 a1 a5 a5 a5 a5 ................ a17 a17 a17 a17 a17 .....................  
F F F F F F F F F F H H H H F F

First Access = 20  Faults (F)

Second Access in reverse order =16 Faults

difference = 0

selected by

No related questions found