Second Chance Algorithm

This is a discussion on Second Chance Algorithm within the C++ Programming forums, part of the General Programming Boards category; a simple modification to FIFO that avoids the problem of throwing out a heavily used page is to inspect the ...

  1. #1
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71

    Second Chance Algorithm

    a simple modification to FIFO that avoids the problem of throwing out a heavily used page is to inspect the R bit of the oldest page. If it is 0, the page is both old and unused, so it is replaced immediately. If the R bit is 1, the bit is cleared, the page is put onto the end of the list of pages, and its load time is updated as though it had just arrived in memory.Then search continues. The operation of this algorithm is called second chance algorithm.

    FIFO is first in, first out i know its working type. The data which enters the queue firstly will be exit first. If i want to implement second chance algorithm with FIFO there will be a question about r_bit variable , i must controll if the array's elements' r_bit is 1 or 0 ?

    how can i do that?

  2. #2
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71
    if i create 2 array, one of the is for the datas and the second one is for the r_bit. I control the elements of both array. But then?

  3. #3
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71
    i want to remind that second chance algorithm is a page replacement algorithm

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    I still don't see what your question is. You've got the algorithm, you've apparently got all the arrays, off you go.

  5. #5
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71
    i could not explain what i want. I did something about the subject.Thanks...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Implement of a Fast Time Series Evaluation Algorithm
    By BiGreat in forum C Programming
    Replies: 7
    Last Post: 12-04-2007, 02:30 AM
  2. Replies: 4
    Last Post: 12-10-2006, 07:08 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21