0
1.6kviews
Calculate no. of page miss and page hits for the page replacement policies FIFO, Optimal & LRU for given string 2 , 3, 3, 1, 5, 2 , 4, 5, 3, 2, 5 , 2(assume frame size 3)

Mumbai University > Information Technology> sem 4> computer organization and architecture

Marks: 10M

Year: May16

1 Answer
1
10views

Paging:

  • Paging is a memory-management scheme which allows the physical address of a process to be non-contiguous.
  • The concept of paging is used to remove the problem of fragmentation. Here we are able to allocate physical memory to the process in a non-contiguous manner wherever memory is available.
  • Paging avoids external fragmentation and the need for compaction. Paging is done by breaking the physical memory into fixed size blocks called frames and breaking the logical memory into blocks of same size called pages.
  • When a process is being executed, the corresponding pages are fetched and loaded into the available memory frames.

FIFO page replacement:

In FIFO page replacement,

when a page is needed to be replaced, we select the oldest page.

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

page miss=9

page hits=3

Optimal Page replacement:

Here, when a page replacement is needed, it looks ahead in the input queue for the page frame which will be referenced only after a long time. The page with the longest reference is swapped.

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

page miss=8

page hits=4

LRU page replacement:

This method uses the recent past as an approximation of near future. We replace the page which has not been referenced for a long time in the past.

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

page miss=9

page hits=3

Please log in to add an answer.