2.6k views

The address sequence generated by tracing a particular program executing in a pure demand based paging system with $100$ records per page with $1$ free main memory frame is recorded as follows. What is the number of page faults?

$0100, 0200, 0430, 0499, 0510, 0530, 0560, 0120, 0220, 0240, 0260, 0320, 0370$

1. $13$
2. $8$
3. $7$
4. $10$
edited | 2.6k views

$0100 - 1$ page fault. Records $0100-0199$ in memory

$0200 - 2$ page faults. Records $0200-0299$ in memory

$0430 - 3$ page faults. Records $0400-0499$ in memory

$0499 - 3$ page faults. Records $0400-0499$ in memory

$0510 - 4$ page faults. Records $0500-0599$ in memory

$0530 - 4$ page faults. Records $0500-0599$ in memory

$0560 - 4$ page faults. Records $0500-0599$ in memory

$0120 - 5$ page faults. Records $0100-0199$ in memory

$0220 - 6$ page faults. Records $0200-0299$ in memory

$0240 - 6$ page faults. Records $0200-0299$ in memory

$0260 - 6$ page faults. Records $0200-0299$ in memory

$0320 - 7$ page faults. Records $0300-0399$ in memory

$0370 - 7$ page faults. Records $0300-0399$ in memory

So, (C) - $7$ page faults.
edited by
0
@Arjun Sir, i did not understand the meaning of "records x-x+100 in memory" ? Can you please explain it
+11
more clarity would come if we would just consider each new reference to be allocated in one available frame. In that case, the range of addresses will be [ first reference + 99 ] addresses per frame.

because, in question it says only 1 free main memory frame and 100 records per frame.

1. 100 -> range [100,199] =  fault

2. 200 -> range [200, 299] =  fault

3. 430 -> range [430 , 529] =  fault

4. 499 -> prev frame =  hit

5. 510 -> prev frame = hit

6. 530 -> range [530 , 629] -=fault

7. 560 -> prev frame = hit

8. 120 -> range [120 , 219] = fault

9. 220 -> range [220 , 319] = fault

10. 240 -> prev frame = hit

11. 260 -> prev frame = hit

12. 320 -> range [320 , 419] = fault

13. 370 -> prev frame = hit

Therefore, total fault =7
0
Arjun sir this is not clear to me. Sir you pls explain why in the 8 th row when 0120  is added how the page fault n is going to increase 5 from 4 .
+15

locality of refrence. means when memory address $0120$ is referred. complete page is loaded in main memory $[100,199]$. So, if $0172$ is referred next, then there will not be any page fault.

+1

mcjoshi explain 8 and 9 point pls .

0
@mcjoshi

It is spatial locality to be precised.
page are fitted in frames ,so first we need to determine the pages but given request are just the record request in decimal.we can assume that first page to address from 0000 to 0099 and page 2 contains records from 0100 to 0199 and so on(it is given in question that each page contains 100 records) and so on.sso page reqquest string is 01,02,04,04,05,05,05,01,02,02,02,03,03 clearly 7 page fault.
+1
this is very clear and right answer i think
0
Beautiful!

Since no of record in each page is 100 try to normalize the given value.

normalized value for each record is given by floor( given value /100 )

so you will get 01,02,04,04,05,05,05,01,02,02,02,,03,03

you can remove 0 from prefix if you love to remove .

now easily we can get 7 as total page fault.

1
2