Three frames. One request at a time.
All frames start empty. Follow the same request string with each policy. F means fault; H means hit.
Request 1: page 7 — Fault
Page 7 is absent. This request counts as one fault, including when a free frame is available.
Use empty frame 0
No eviction is necessary. We use free frames in increasing frame-number order.
Load page 7 into frame 0
Fill the free frame. Add the new page to the queue with R=0, following the course convention.
Request 2: page 0 — Fault
Page 0 is absent. This request counts as one fault, including when a free frame is available.
Use empty frame 1
No eviction is necessary. We use free frames in increasing frame-number order.
Load page 0 into frame 1
Fill the free frame. Add the new page to the queue with R=0, following the course convention.
Request 3: page 1 — Fault
Page 1 is absent. This request counts as one fault, including when a free frame is available.
Use empty frame 2
No eviction is necessary. We use free frames in increasing frame-number order.
Load page 1 into frame 2
Fill the free frame. Add the new page to the queue with R=0, following the course convention.
Request 4: page 2 — Fault
Page 2 is absent. This request counts as one fault, including when a free frame is available.
Inspect page 7: R = 0
This page has no remaining second chance. Select it as the victim.
Evict page 7 from frame 0
Page 7 is at the queue head with R=0. Its frame can be reused.
Load page 2 into frame 0
Replace page 7. A modified victim would first need a write-back. Add the new page to the queue with R=0, following the course convention.
Request 5: page 0 — Hit
Page 0 is already in frame 1. No page needs to be loaded or evicted.
Hit: update the bookkeeping
Set page 0’s reference bit to 1. Its queue position and physical frame stay unchanged.
Request 6: page 3 — Fault
Page 3 is absent. This request counts as one fault, including when a free frame is available.
Inspect page 0: R = 1
This page has been referenced. Give it a second chance before considering an eviction.
Give page 0 a second chance
Clear its reference bit to 0 and move its queue entry to the end. Page 0 stays in frame 1. Continue the same request; this is not another fault.
Inspect page 1: R = 0
This page has no remaining second chance. Select it as the victim.
Evict page 1 from frame 2
Page 1 is at the queue head with R=0. Its frame can be reused.
Load page 3 into frame 2
Replace page 1. A modified victim would first need a write-back. Add the new page to the queue with R=0, following the course convention.
Request 7: page 0 — Hit
Page 0 is already in frame 1. No page needs to be loaded or evicted.
Hit: update the bookkeeping
Set page 0’s reference bit to 1. Its queue position and physical frame stay unchanged.
Request 8: page 4 — Fault
Page 4 is absent. This request counts as one fault, including when a free frame is available.
Inspect page 2: R = 0
This page has no remaining second chance. Select it as the victim.
Evict page 2 from frame 0
Page 2 is at the queue head with R=0. Its frame can be reused.
Load page 4 into frame 0
Replace page 2. A modified victim would first need a write-back. Add the new page to the queue with R=0, following the course convention.
Request 9: page 2 — Fault
Page 2 is absent. This request counts as one fault, including when a free frame is available.
Inspect page 0: R = 1
This page has been referenced. Give it a second chance before considering an eviction.
Give page 0 a second chance
Clear its reference bit to 0 and move its queue entry to the end. Page 0 stays in frame 1. Continue the same request; this is not another fault.
Inspect page 3: R = 0
This page has no remaining second chance. Select it as the victim.
Evict page 3 from frame 2
Page 3 is at the queue head with R=0. Its frame can be reused.
Load page 2 into frame 2
Replace page 3. A modified victim would first need a write-back. Add the new page to the queue with R=0, following the course convention.
Request 10: page 3 — Fault
Page 3 is absent. This request counts as one fault, including when a free frame is available.
Inspect page 4: R = 0
This page has no remaining second chance. Select it as the victim.
Evict page 4 from frame 0
Page 4 is at the queue head with R=0. Its frame can be reused.
Load page 3 into frame 0
Replace page 4. A modified victim would first need a write-back. Add the new page to the queue with R=0, following the course convention.
Three frames. One request at a time.
All frames start empty. Follow the same request string with each policy. F means fault; H means hit.
Course convention: load with R=0; a later hit sets R=1. Inspecting or clearing bits does not create another request or fault.