Partitions vary depending on the size of a process. The placement with dynamic allocation
is to allocate exactly the size of a process in the memory.
However, when processes exit, holes might be created between every two processes.
This is called External Fragmentation.
When OS move processes down to eliminate holes, larger free space are created.
This action is called Memory Compaction.
We need to know what is the maximum size of a process at load time. Otherwise, we
must be able to add to its partition, potentially relocating it.
To keep track of memory allocation, we can use Bitmaps.
Placement Heuristics:
Memory compaction is time-consuming. We can reduce compaction if we systematically
allocate memory. The following techniques give us an idea how this can be achieved.
First-fit, allocate the first block large enough, appears to be the BEST choice, leave
external fragmentation at start of memory
Next-fit, allocate the block where previous search ends at, a variation of first-fit,
free space becomes fragmented more rapidly
Best-fit, scans through the blocks and finds the most suitable block in size,
small, unusable fragments
Worst-fit, find the largest block
Quick-fit, keep multiple free lists for common block sizes,
fast allocation, harder to coalesce
Relocation:
a way to change the physical memory reference
Dynamic relocation:
execution-time binding of addresses, hardware translates to physical addresses as instructions are executed.
base address + relative address = physical address <= limit address
Basic problems that cause internal fragmentation and external fragmentation and so on...:
we assume processes are allocated to contiguous block of memory
Solution: Paging
To be continued...
No comments:
Post a Comment