jeco.dmm.sim2.lib.allocator
Class BuddySystem

java.lang.Object
  extended by jeco.dmm.sim2.lib.allocator.Allocator
      extended by jeco.dmm.sim2.lib.allocator.SegregatedFreeList
          extended by jeco.dmm.sim2.lib.allocator.SegregatedFit
              extended by jeco.dmm.sim2.lib.allocator.StrictSegregatedFit
                  extended by jeco.dmm.sim2.lib.allocator.BuddySystem

public class BuddySystem
extends StrictSegregatedFit

Author:
jlrisco

Nested Class Summary
static class BuddySystem.TYPE
           
 
Field Summary
protected  int baseIndex
           
protected  BuddySystem.TYPE type
           
 
Fields inherited from class jeco.dmm.sim2.lib.allocator.Allocator
allowCoalescing, allowSplitting, freeLists, maxSizeInB, metrics, minSizeInB
 
Constructor Summary
BuddySystem(BuddySystem.TYPE type, long minSizeInB, long maxSizeInB, boolean allowSplitting, boolean allowCoalescing)
           
 
Method Summary
 Block coalesce(long sizeInB)
           
 int computeFreeListIndex(long sizeInB)
           
static long fibonacci(int n)
           
 BuddySystem.TYPE getType()
           
 void setup(FreeList.DATA_STRUCTURE dataStructure, FreeList.ALLOCATION_MECHANISM allocationMechanism, FreeList.ALLOCATION_POLICY allocationPolicy)
           
 Block split(long sizeInB)
           
 
Methods inherited from class jeco.dmm.sim2.lib.allocator.StrictSegregatedFit
malloc
 
Methods inherited from class jeco.dmm.sim2.lib.allocator.Allocator
add, canManage, getFreeLists, getMaxSizeInB, getMinSizeInB, isAllowCoalescing, isAllowSplitting, setMaxSizeInB, setMetrics, setMinSizeInB
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected BuddySystem.TYPE type

baseIndex

protected int baseIndex
Constructor Detail

BuddySystem

public BuddySystem(BuddySystem.TYPE type,
                   long minSizeInB,
                   long maxSizeInB,
                   boolean allowSplitting,
                   boolean allowCoalescing)
Method Detail

getType

public BuddySystem.TYPE getType()

setup

public void setup(FreeList.DATA_STRUCTURE dataStructure,
                  FreeList.ALLOCATION_MECHANISM allocationMechanism,
                  FreeList.ALLOCATION_POLICY allocationPolicy)
Overrides:
setup in class SegregatedFreeList

computeFreeListIndex

public int computeFreeListIndex(long sizeInB)
Specified by:
computeFreeListIndex in class StrictSegregatedFit

fibonacci

public static long fibonacci(int n)

coalesce

public Block coalesce(long sizeInB)
Specified by:
coalesce in class StrictSegregatedFit

split

public Block split(long sizeInB)
Specified by:
split in class StrictSegregatedFit