bufmgr
Class Clock

java.lang.Object
  extended byglobal.AbstractBufMgrReplacer
      extended bybufmgr.Replacer
          extended bybufmgr.Clock
All Implemented Interfaces:
GlobalConst

public class Clock
extends Replacer

A clock algorithm for buffer pool replacement policy. It picks up the frame in the buffer pool to be replaced. This is the default replacement policy.


Field Summary
 
Fields inherited from class global.AbstractBufMgrReplacer
Available, Pinned, Referenced
 
Fields inherited from interface global.GlobalConst
INVALID_PAGE, MAX_NAME, MAXATTRNAME, MAXFILENAME, MAXINDEXNAME, MINIBASE_BUFFER_POOL_SIZE, MINIBASE_DB_SIZE, MINIBASE_DEFAULT_SHAREDMEM_SIZE, MINIBASE_MAX_TRANSACTIONS, MINIBASE_MAXARRSIZE, NUMBUF, PAGE_SIZE, PAGESIZE
 
Constructor Summary
Clock()
           
Clock(AbstractBufMgr javamgr)
          Creates a clock object.
 
Method Summary
 void info()
          Displays information from clock replacement algorithm.
 java.lang.String name()
          Returns the name of the clock algorithm as a string.
 int pick_victim()
          Picks up the victim frame to be replaced according to the clock algorithm.
 void setBufferManager(AbstractBufMgr mgrArg)
          Sets the buffer manager to be eqaul to the buffer manager in the argument, gets the total number of buffer frames, and mainstains the head of the clock.
 
Methods inherited from class bufmgr.Replacer
free, getNumUnpinnedBuffers, pin, unpin
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Clock

public Clock()

Clock

public Clock(AbstractBufMgr javamgr)
Creates a clock object.

Method Detail

setBufferManager

public void setBufferManager(AbstractBufMgr mgrArg)
Description copied from class: AbstractBufMgrReplacer
Sets the buffer manager to be eqaul to the buffer manager in the argument, gets the total number of buffer frames, and mainstains the head of the clock.

Overrides:
setBufferManager in class AbstractBufMgrReplacer

pick_victim

public int pick_victim()
                throws BufferPoolExceededException,
                       PagePinnedException
Picks up the victim frame to be replaced according to the clock algorithm. Pin the victim so that other process can not pick it as a victim.

Specified by:
pick_victim in class AbstractBufMgrReplacer
Returns:
-1 if no frame is available. head of the list otherwise.
Throws:
BufferPoolExceededException.
BufferPoolExceededException
PagePinnedException

name

public final java.lang.String name()
Returns the name of the clock algorithm as a string.

Specified by:
name in class AbstractBufMgrReplacer
Returns:
"Clock", the name of the algorithm.

info

public void info()
Displays information from clock replacement algorithm.

Overrides:
info in class Replacer