jeco.dmm.sim2.lib.allocator
Class Allocator

java.lang.Object
  extended by jeco.dmm.sim2.lib.allocator.Allocator
Direct Known Subclasses:
SegregatedFreeList

public abstract class Allocator
extends java.lang.Object

Author:
jlrisco

Field Summary
protected  boolean allowCoalescing
           
protected  boolean allowSplitting
           
protected  java.util.ArrayList<FreeList> freeLists
           
protected  long maxSizeInB
          Max memory block size managed by this allocator (sizeInB <= maxSizeInB).
protected  Metrics metrics
           
protected  long minSizeInB
          Min memory block size managed by this allocator (minSizeInB < sizeInB).
 
Constructor Summary
Allocator(long minSizeInB, long maxSizeInB, boolean allowSplitting, boolean allowCoalescing)
           
 
Method Summary
 void add(FreeList freeList)
           
 boolean canManage(long sizeInB)
           
 java.util.ArrayList<FreeList> getFreeLists()
           
 long getMaxSizeInB()
           
 long getMinSizeInB()
           
 boolean isAllowCoalescing()
           
 boolean isAllowSplitting()
           
abstract  Block malloc(long sizeInB, Block hottest)
          Typical malloc allocation.
 void setMaxSizeInB(long maxSizeInB)
           
 void setMetrics(Metrics metrics)
           
 void setMinSizeInB(long minSizeInB)
           
abstract  void setup(FreeList.DATA_STRUCTURE dataStructure, FreeList.ALLOCATION_MECHANISM allocationMechanism, FreeList.ALLOCATION_POLICY allocationPolicy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

metrics

protected Metrics metrics

minSizeInB

protected long minSizeInB
Min memory block size managed by this allocator (minSizeInB < sizeInB).


maxSizeInB

protected long maxSizeInB
Max memory block size managed by this allocator (sizeInB <= maxSizeInB).


freeLists

protected java.util.ArrayList<FreeList> freeLists

allowSplitting

protected boolean allowSplitting

allowCoalescing

protected boolean allowCoalescing
Constructor Detail

Allocator

public Allocator(long minSizeInB,
                 long maxSizeInB,
                 boolean allowSplitting,
                 boolean allowCoalescing)
Method Detail

setMetrics

public void setMetrics(Metrics metrics)

getMinSizeInB

public long getMinSizeInB()

setMinSizeInB

public void setMinSizeInB(long minSizeInB)

getMaxSizeInB

public long getMaxSizeInB()

setMaxSizeInB

public void setMaxSizeInB(long maxSizeInB)

getFreeLists

public java.util.ArrayList<FreeList> getFreeLists()

isAllowSplitting

public boolean isAllowSplitting()

isAllowCoalescing

public boolean isAllowCoalescing()

add

public void add(FreeList freeList)

canManage

public boolean canManage(long sizeInB)

setup

public abstract void setup(FreeList.DATA_STRUCTURE dataStructure,
                           FreeList.ALLOCATION_MECHANISM allocationMechanism,
                           FreeList.ALLOCATION_POLICY allocationPolicy)

malloc

public abstract Block malloc(long sizeInB,
                             Block hottest)
Typical malloc allocation.

Parameters:
sizeInB - sizeInB Size in bytes
hottest - For reliability purposes, the hottest block
Returns:
The block created