written 3.1 years ago by | • modified 3.1 years ago |
Paging:-
a) Paging is a memory management technique which allows physical address space of the process to be noncontiguous.
b) In some sense, paging mechanism is similar to reading of a book . When we read a book we only see and need to open the current page to read.
c)All the other pages are not visible to us and remains closed.
d)In the same manner, we can say that even when we may have a large program available, the processor only needs a small set of instructions to execute at any time.
e) In fact, all these instructions which the processor needs to execute are within a small proximity of each other.
f) This is like a page which contains all the statements which we are currently reading.
g)In this way paging allows to keep just the parts of a process that we're using in memory and the rest on the disk.
Calculate the hit ratio for the same. 1,2,3,4,5,3,4,1,6,7,8,7,8,9,7,8,9,5,4,5,4,2 Page frame size is 4.
LRU
No of Hits :- 9
Miss- 13
FIFO Page replacement
Frame | 1 | 2 | 3 | 4 | 5 | 3 | 4 | 1 | 6 | 7 | 8 | 7 | 8 | 9 | 7 | 8 | 9 | 5 | 4 | 5 | 4 | 2 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 5 | 5 | 5 | 5 | 5 | 5 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 2 |
1 | 2 | 2 | 2 | 2 | 2 | 2 | 1 | 1 | 1 | 1 | 1 | 1 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | |
2 | 3 | 3 | 3 | 3 | 3 | 3 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 5 | 5 | 5 | 5 | 5 | ||
3 | 4 | 4 | 4 | 4 | 4 | 4 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 4 | 4 | 4 | 4 | |||
PF | Y | Y | Y | Y | Y | - | - | Y | Y | Y | Y | - | - | Y | - | - | - | Y | Y | - | - | Y |
No of Hits :- 9
Miss- 13
Optimal page replacement
Frame | 1 | 2 | 3 | 4 | 5 | 3 | 4 | 1 | 6 | 7 | 8 | 7 | 8 | 9 | 7 | 8 | 9 | 5 | 4 | 5 | 4 | 2 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 6 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 4 | 4 | 4 | 2 |
1 | 2 | 2 | 2 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | |
2 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | ||
3 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | |||
PF | Y | Y | Y | Y | Y | - | - | - | Y | Y | Y | - | - | Y | - | - | - | - | Y | - | - | Y |
No of Hits :- 11
Miss- 11