For the following page reference string: 4, 3, 2, 1, 4, 3, 5, 4, 3, 2, 1, 5 — the number of page faults that occur using the Least Recently Used (LRU) page replacement algorithm with frame size 3 is:
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: C. 10
Explanation
Tracing LRU with 3 frames (F = fault): ref 4→[4] F; 3→[4,3] F; 2→[4,3,2] F; 1→frames full, evict LRU 4→[3,2,1] F; 4→evict LRU 3→[2,1,4] F; 3→evict LRU 2→[1,4,3] F; 5→evict LRU 1→[4,3,5] F; 4→hit (in frames, just refresh recency)→no fault; 3→hit→no fault; 2→evict LRU 5→[4,3,2] F; 1→evict LRU 4→[3,2,1] F; 5→evict LRU 3→[2,1,5] F. Counting the faults gives 10 in total (every reference faults except the two hits on 4 and 3 in the middle of the string), so the answer is 10, option (iii).More Programming Languages and Computer Graphics questions
- Given memory access time as p nanoseconds and an additional q nanoseconds for handling a page fault, what is the effective memory access ti…
- Consider a machine with 16 GB of main memory and a 32-bit virtual address space, with page size 4 KB (frame size equals page size). If a pr…
- (Same machine as above: 16 GB main memory, 32-bit virtual address space, 4 KB page size.) What is the size of the page table needed to hand…
- (Same machine as above: 16 GB main memory, 32-bit virtual address space, 4 KB page size.) What is the minimum number of bits needed for the…
- (Same machine as above: 16 GB main memory, 32-bit virtual address space, 4 KB page size.) The number of bits reserved for the frame offset…
- (Same machine as above: 32-bit virtual address space, 4 KB page size.) Find the number of pages required for the given virtual address spac…