Consider the page-reference string: 0 1 2 3 0 1 4 0 1 2 3 4. If the FIFO page-replacement algorithm is used, find the number of page faults for (a) 3 page frames and (b) 4 page frames, respectively.
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. 9, 10
Explanation
With 3 frames (FIFO queue, oldest evicted first): 0,1,2 fault and fill the frames [0,1,2]; 3 faults, evicting 0 → [1,2,3]; 0 faults, evicting 1 → [2,3,0]; 1 faults, evicting 2 → [3,0,1]; 4 faults, evicting 3 → [0,1,4]; the next 0 and 1 are hits; 2 faults, evicting 0 → [1,4,2]; 3 faults, evicting 1 → [4,2,3]; the final 4 is a hit — giving 9 faults in total. With 4 frames: 0,1,2,3 fault and fill [0,1,2,3]; the next 0 and 1 are hits; 4 faults, evicting 0 → [1,2,3,4]; 0 faults, evicting 1 → [2,3,4,0]; 1 faults, evicting 2 → [3,4,0,1]; 2 faults, evicting 3 → [4,0,1,2]; 3 faults, evicting 4 → [0,1,2,3]; the final 4 faults, evicting 0 — giving 10 faults in total. So the answer is 9, 10, option (iv) — a textbook example of Belady's anomaly, where adding a frame under FIFO actually increased the fault count.More System Software and Operating System questions
- Indexed/grouped allocation (of disk blocks to a file) is useful because: (A) It supports both sequential and direct access. (B) The entire…
- A moving-head disk has 200 tracks, numbered 0 to 199. The head has just finished a request at track 125 and is currently at track 143 (so i…
- In a file allocation system, the following allocation schemes are used: (A) Contiguous allocation, (B) Indexed allocation, (C) Linked alloc…
- Suppose a Linux file system has a block size of 2K bytes, a disk address is 32 bits, and an i-node contains the disk addresses of the first…
- Consider a disk system having 60 cylinders. Disk requests are received by the disk drive for cylinders 10, 22, 20, 2, 40, 6, and 38, in tha…
- A disk queue has requests for I/O on cylinders 98, 183, 37, 122, 14, 124, 65, 67, with the disk head currently at cylinder 53. Using the sh…