Methoden
Class FirstFit
java.lang.Object
|
+--Methoden.AllocationMethod
|
+--Methoden.FirstFit
- public class FirstFit
- extends AllocationMethod
Implementation of the allocation method first-fit.
The selected memory area for allocation is the first memory area with
sufficient size. The search for this memory area starts at the first free
memory area. The free memory areas are sorted ascending by the starting
position in memory.
|
Field Summary |
static java.lang.String |
LONGNAME
Short name of this allocation method |
static java.lang.String |
SHORTNAME
Long name of this allocation method |
|
Constructor Summary |
FirstFit()
First-Fit is an implementation of the allocatio method class
and searches for the next avalable free memory area starting each time
at the beginning of memory. |
|
Method Summary |
Memory |
buildFreeMemory(Memory usedMemory)
Build up a free memory according to the given used memory. |
MemoryArea |
getFreeArea(Memory freeMemory,
int reqSize)
Returns the first free memory area where the requestedSize fits into.
|
void |
sortFreeMemory(Memory memory)
Sorts the free memory structure ascending by the starting position
of each memory area. |
void |
sortUsedMemory(Memory memory)
Sorts the used memory structure ascending by the starting position
of each memory area. |
| Methods inherited from class Methoden.AllocationMethod |
appendMemoryArea, createRandomUsedMemory, createUsedMemory, getFreeAreasCount, getIntFrag, getLongName, getShortName, getUsage, isUseFullFreeMemoryArea, mergeMemoryArea, removeMemoryArea, removeMemoryAreaProcess |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
SHORTNAME
public static final java.lang.String SHORTNAME
- Long name of this allocation method
LONGNAME
public static final java.lang.String LONGNAME
- Short name of this allocation method
FirstFit
public FirstFit()
- First-Fit is an implementation of the allocatio method class
and searches for the next avalable free memory area starting each time
at the beginning of memory.
sortFreeMemory
public void sortFreeMemory(Memory memory)
- Sorts the free memory structure ascending by the starting position
of each memory area.
- Overrides:
sortFreeMemory in class AllocationMethod
sortUsedMemory
public void sortUsedMemory(Memory memory)
- Sorts the used memory structure ascending by the starting position
of each memory area.
- Overrides:
sortUsedMemory in class AllocationMethod
buildFreeMemory
public Memory buildFreeMemory(Memory usedMemory)
- Build up a free memory according to the given used memory.
- Overrides:
buildFreeMemory in class AllocationMethod
getFreeArea
public MemoryArea getFreeArea(Memory freeMemory,
int reqSize)
- Returns the first free memory area where the requestedSize fits into.
If none was found, return null.
- Overrides:
getFreeArea in class AllocationMethod