|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--Methoden.AllocationMethod
|
+--Methoden.Buddy
Implementation of the allocation method Buddy-System. The selected memory area for allocation is the first free memory area with sufficient size. The search for this memory area starts the first time at the first free memory area. Every succeding search continues at the last resulting free memory area if one exist, else at the next free memory area following the allocated one. 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 |
| Fields inherited from class Methoden.AllocationMethod |
longName, shortName |
| Constructor Summary | |
Buddy()
Buddy-System is an implementation of the allocatio method class and searches for the next avalable free memory area starting from the beginning of memory and resuming the search each time at the last stop point. |
|
| Method Summary | |
void |
appendMemoryArea(Memory usedMemory,
MemoryArea newMemoryArea)
Appends a new memory area into the memory structure. |
static Memory |
buildFlatMemory(Memory usedMemory)
Build up a flat memory. |
Memory |
buildFreeMemory(Memory usedMemory)
Build up a free memory according to the given used memory. |
Memory |
createRandomUsedMemory(Memory usedMemory)
Creates a new random used memory regarding the specific needs to the memory structure of the buddy system. |
Memory |
createUsedMemory(int newMemoryAreaCount,
int newMemorySize)
Creates a new empty used memory. |
private MemoryArea |
getBuddy(MemoryArea memoryArea)
Returns the corresponding buddy of the given memoryArea. |
MemoryArea |
getFreeArea(Memory freeMemory,
int reqSize)
Returns the first free memory area where the requestedSize fits into. |
int |
getFreeAreasCount(Memory freeMemory)
Returns the number of free memory areas. |
boolean |
isUseFullFreeMemoryArea()
Returns true, if the full free memory area should be used. |
void |
mergeMemoryArea(Memory freeMemory,
MemoryArea mergeMemoryArea)
Merge the given free memoryArea with the given free memory. |
void |
removeMemoryArea(Memory memory,
int startPos)
Removes the requested memoryArea in the given memory |
| Methods inherited from class Methoden.AllocationMethod |
getIntFrag, getLongName, getShortName, getUsage, removeMemoryAreaProcess, sortFreeMemory, sortUsedMemory |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final java.lang.String SHORTNAME
public static final java.lang.String LONGNAME
| Constructor Detail |
public Buddy()
| Method Detail |
public Memory createUsedMemory(int newMemoryAreaCount,
int newMemorySize)
createUsedMemory in class AllocationMethodpublic Memory createRandomUsedMemory(Memory usedMemory)
createRandomUsedMemory in class AllocationMethodpublic Memory buildFreeMemory(Memory usedMemory)
buildFreeMemory in class AllocationMethodpublic static Memory buildFlatMemory(Memory usedMemory)
public void appendMemoryArea(Memory usedMemory,
MemoryArea newMemoryArea)
appendMemoryArea in class AllocationMethodpublic int getFreeAreasCount(Memory freeMemory)
getFreeAreasCount in class AllocationMethod
public MemoryArea getFreeArea(Memory freeMemory,
int reqSize)
getFreeArea in class AllocationMethodpublic boolean isUseFullFreeMemoryArea()
isUseFullFreeMemoryArea in class AllocationMethodprivate MemoryArea getBuddy(MemoryArea memoryArea)
public void mergeMemoryArea(Memory freeMemory,
MemoryArea mergeMemoryArea)
mergeMemoryArea in class AllocationMethod
public void removeMemoryArea(Memory memory,
int startPos)
removeMemoryArea in class AllocationMethod
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||