Created
November 10, 2012 18:52
-
-
Save Jberlinsky/4052113 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Status BufMgr::allocBuf(unsigned int & frame) | |
{ | |
if (numUnpinnedPages() == 0) | |
return BUFFEREXCEEDED; | |
while ( 1 ) { | |
advanceClock(); // advance clock hand | |
if ( bufTable[clockHand].valid == true ) { | |
if ( bufTable[clockHand].loved == true ) { | |
bufTable[clockHand].loved = false; | |
continue; | |
} | |
else if ( bufTable[clockHand].pinCnt > 0 ) { | |
continue; | |
} | |
else if ( bufTable[clockHand].dirty == true) { | |
flushFile( bufTable[clockHand].file ); | |
} | |
} | |
bufTable[clockHand].Clear (); | |
frame = clockHand; | |
return OK; // all good | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This looks all wrong.