Strategie
Class FIFO

java.lang.Object
  |
  +--Strategie.ReplaceStrategy
        |
        +--Strategie.FIFO

public class FIFO
extends ReplaceStrategy

Implementation of the page replacement strategy FIFO (First-In-First-Out). The victim page is selected by a rotating pointer, that goes around the memory pages without any priority or preferences


Field Summary
static boolean ISACCESSCOUNT
          Number of accesses is not relevant for this strategy.
static boolean ISACCESSTIME
          Time of access is not relevant for this strategy.
static boolean ISINSERTIONTIME
          Time of insertion is relevant for this strategy.
static java.lang.String LONGNAME
          Long name of this streategy.
static int MODBITCOUNT
          Number of reference-bits of this strategy.
static int REFBITCOUNT
          Number of reference-bits of this strategy.
static java.lang.String SHORTNAME
          Short name of this streategy.
 
Fields inherited from class Strategie.ReplaceStrategy
isAccessCount, isAccessTime, isInsertTime, isShowMemoryDetails, longName, modifyBitCount, referenceBitCount, shortName
 
Constructor Summary
FIFO(boolean showDetails)
          Creates a new instance of this strategy.
 
Method Summary
 Memory createMemory(int size, int refBits, int modBits)
          Creates a new memory structure with the given size and number of reference- and modifyBits.
 int getDrawLfdNr(Memory memory, int i)
          Returns the index of the frame i in memory structure.
 Page getVictimPage(Memory memory, SimuData simu, GUI gui)
          Selects the next victim page.
 void replacePage(Memory memory, Page oldPage, Page newPage, SimuData simu, GUI gui)
          Replaces the oldPage by the newPage in memory.
 void setInitVictimPointer(Memory memory)
          Sets the indexpointer to the page that has to be placed first.
 void sortMemory(Memory memory)
          Sorts the memory by insertiontime of each page.
 
Methods inherited from class Strategie.ReplaceStrategy
getLongName, getModifyBitCount, getReferenceBitCount, getShortName, isAccessCount, isAccessTime, isInsertTime, isModifyBit, isReferenceBit, isShowMemoryDetails, reInsertPage, setShowMemoryDetails
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

SHORTNAME

public static final java.lang.String SHORTNAME
Short name of this streategy.

LONGNAME

public static final java.lang.String LONGNAME
Long name of this streategy.

REFBITCOUNT

public static final int REFBITCOUNT
Number of reference-bits of this strategy.

MODBITCOUNT

public static final int MODBITCOUNT
Number of reference-bits of this strategy.

ISACCESSCOUNT

public static final boolean ISACCESSCOUNT
Number of accesses is not relevant for this strategy.

ISACCESSTIME

public static final boolean ISACCESSTIME
Time of access is not relevant for this strategy.

ISINSERTIONTIME

public static final boolean ISINSERTIONTIME
Time of insertion is relevant for this strategy.
Constructor Detail

FIFO

public FIFO(boolean showDetails)
Creates a new instance of this strategy.
Method Detail

createMemory

public Memory createMemory(int size,
                           int refBits,
                           int modBits)
Creates a new memory structure with the given size and number of reference- and modifyBits.
Overrides:
createMemory in class ReplaceStrategy

setInitVictimPointer

public void setInitVictimPointer(Memory memory)
Sets the indexpointer to the page that has to be placed first. Only needed at the beginning when creating new memory.
Overrides:
setInitVictimPointer in class ReplaceStrategy

sortMemory

public void sortMemory(Memory memory)
Sorts the memory by insertiontime of each page. Caution: For a simple solution the old framenumber will be overwritten.
Overrides:
sortMemory in class ReplaceStrategy

getDrawLfdNr

public int getDrawLfdNr(Memory memory,
                        int i)
Returns the index of the frame i in memory structure. The memory structure can have an strategy-dependant internal sort. This is needed for drawing the memory details in the strategy-dependant order.
Overrides:
getDrawLfdNr in class ReplaceStrategy

getVictimPage

public Page getVictimPage(Memory memory,
                          SimuData simu,
                          GUI gui)
Selects the next victim page. It's the oldest page in memory.
Overrides:
getVictimPage in class ReplaceStrategy

replacePage

public void replacePage(Memory memory,
                        Page oldPage,
                        Page newPage,
                        SimuData simu,
                        GUI gui)
Replaces the oldPage by the newPage in memory.
Overrides:
replacePage in class ReplaceStrategy