Memory Partitioning

Dynamic Partitioning

In dynamic partitioning, each partition if of variable length and number.

  • Process is allocated exactly as much memory as required
  • Eventually get holes in the memory called External Fragmentation
  • Must use Compaction to shift processes so they are contiguous and all free memory is in one block

Placement Algorithms

The OS must be clever in deciding how to assign processes to memory (how to plug the holes). How to decide which chunk of memory to allocate to the process?

First-fit algorithm

  • Scans memory from the beginning and chooses the first available block that is large enough
  • Fastest
  • May have many processes loaded in the front end of memory that must be searched over when trying to find a free block

Next-fit

  • Scans memory from the location of the last placement
  • More often allocates a block of memory at the end of memory where the largest block is found
  • The largest block of memory is broken up into smaller blocks
  • Compaction is required to obtain a large block at the end of memory

Best-fit

  • chooses the block that is closest in size to the request