Assume there are 3 frames in physical memory. Frame 1 has reference string 'a', Frame 2 has reference string 'b', Frame 3 has reference string 'c'. And their use bits are 1. And the next sequence victim is Frame 2.
If the next reference string is 'b', in Second Chance Algorithm, we set the Frame 2's use bit to 1 again. After that, if the next reference string is 'd', Frame 2 will be replaced to 'd', and the use bits of Frame 1 and Frame 3 will be set to 0, too.
Why second chance algorithm didn't change the victim to Frame 3 after the reference string 'b' come? b is the most recent reference but why we have it replaced?
EDIT
Maybe I made some mistakes on Second Chance Algorithm.
For example, if the sequence of references is 'e b c a b c b d' and there are 3 frames in physical memory, my steps are:
Sequence Number: 0
Frame 1(victim):
Reference: null
Use Bit: 0
Frame 2:
Reference: null
Use Bit: 0
Frame 3:
Reference: null
Use Bit: 0
Sequence Number: 1
Reference: e
Page Fault: true
Frame 1:
Reference: e
Use Bit: 1
Frame 2(victim):
Reference: null
Use Bit: 0
Frame 3:
Reference: null
Use Bit: 0
Sequence Number: 2
Reference: b
Page Fault: true
Frame 1:
Reference: e
Use Bit: 1
Frame 2:
Reference: b
Use Bit: 1
Frame 3(victim):
Reference: null
Use Bit: 0
Sequence Number: 3
Reference: c
Page Fault: true
Frame 1(victim):
Reference: e
Use Bit: 1
Frame 2:
Reference: b
Use Bit: 1
Frame 3:
Reference: c
Use Bit: 1
Sequence Number: 4
Reference: a
Page Fault: true
Frame 1:
Reference: a
Use Bit: 1
Frame 2(victim):
Reference: b
Use Bit: 0
Frame 3:
Reference: c
Use Bit: 0
Sequence Number: 5
Reference: b
Page Fault: false
Frame 1:
Reference: a
Use Bit: 1
Frame 2(victim):
Reference: b
Use Bit: 1
Frame 3:
Reference: c
Use Bit: 0
Sequence Number: 6
Reference: c
Page Fault: false
Frame 1:
Reference: a
Use Bit: 1
Frame 2(victim):
Reference: b
Use Bit: 1
Frame 3:
Reference: c
Use Bit: 1
Sequence Number: 7
Reference: b
Page Fault: false
Frame 1:
Reference: a
Use Bit: 1
Frame 2(victim):
Reference: b
Use Bit: 1
Frame 3:
Reference: c
Use Bit: 1
Sequence Number: 8
Reference: d
Page Fault: true
Frame 1:
Reference: a
Use Bit: 0
Frame 2:
Reference: d
Use Bit: 1
Frame 3(victim):
Reference: c
Use Bit: 0
Number of Page Fault: 5
Between Sequence 7 and Sequence 8, the frame 2 was replaced. Am I correct?