Memory Allocation Project
Memory management brief introduction
What is the function of the memory management ?
The memory management function In operating systems is to keep track the
status either allocated or free. When memory is going to be allocated it determines where
it should be allocated. It have all the memory (free and allocated) and track their status
frequently .
Memory management system provides:
1. Large Address Space
2. Protection
3. Memory Mapping
4. Physical Memory Allocation for Processes
5. Shared Virtual Memory
Segmentation:
Segmentation is a memory management
technique that divided each process into
several segments with different sizes for each segment ,for example divide the module into
factions. And allocate each segment separately in the address space.
When a process is going to execute, we check the segmentation table to get the segments
needed for the execution.
Requirements For Memory Allocation and Memory deallocation Project
Inputs:
the data of the process name and segments number.
the segments name and size.
Allocation algorithm first or best algorithm.
Deallocate a process.
Deallocation address (for deallocate form system).
Output:
Draw the memory space (holes ,allocated for processes , allocated for the system).
Segmentation Table.
Parts of the project
Design and Implement GUI.
Design and Implement The Logic.
Design GUI
This gui designed to be simple and easy to use as we would see guide that in the guide.
Figure 23:Gui Design
User Guide
1. Enter the size of the memory then a block of memory with this size would be draw in the
Graphics view on the Right.
2. Enter the start and size for a hole then Click add hole ,A hole at the start would add by the size.
3. Entre the start of An allocated block you want to deallocate from the system and Click Dalloc
Button ,the block would be free.
4. add the process name and the segments number then it would be appear in the Process Data
compo box to enter it’s data.
5. then chose the process you want and insert the segments name and their size.
6. if you entered all the process segments then you are able to choose the allocation algorithm and
click allocate and the memory space would be updated if the process are successfully allocated
else error message would appear.
7. To deallocate a process chose it from the compo box and click deallocate the it would be
deallocated and the block memory would be updated.
Flow Chart
Figure 24:Gui Flow Chart.
Sample of Warning messages, that prevent the user from any expected errors
Figure 25: if you click on the process to deallocate.
Figure 26:process can’t allocate as one or more segment does not have a suitable space
Figure 27:when trying deallocate a process segment.
Figure 28:indecation for the process has all the segments
And there is more of the Warning messages ,that I made for make testing phase much easier.
Algorithms Logic Design
I implement both first and best algorithms on code blocks first, then merge them with the qt gui.
And the implementation gave the user many options like using Both first and best Algorithm in the same
Example ,but with different processes.
Example
initiate the system with with holes (100,50),(200,100),(400,150).
First allocation example:
Then add process with segments Simulink(110),simlink2(40) ,code(40),code2(10).
best allocation example:
Then add process with segments Simulink(110),simlink2(40) ,code(40),code2(10).
Class diagram
Classes Description
class block represent the block Which is one of three(hole ,allocated for a
process ,allocated for the System) ,we use this also to Draw in the Gui.
Class MySquer I just made it to inherit from the library ,that I use to draw
square in the Graphics View.
Class process the represent the process with it name ,segments ,and the
include the segmentation table.
Class GUI used for interfacing ,take data ,and make actions(messages ,draw
memory space ,draw segmentation table).