Skip to main content
Engineering LibreTexts

7.4: Memory Partitioning

  • Page ID
    48680
  • Partition Allocation Methods in Memory Management

    In the world of computer operating system, there are four common memory management techniques. They are:

    1. Single contiguous allocation: Simplest allocation method used by MS-DOS. All memory (except some reserved for OS) is available to a process. 
    2. Partitioned allocation: Memory is divided into different blocks or partitions. Each process is allocated according to the requirement. 
    3. Paged memory management: Memory is divided into fixed-sized units called page frames, used in a virtual memory environment. 
    4. Segmented memory management: Memory is divided into different segments (a segment is a logical grouping of the process’ data or code).In this management, allocated memory doesn’t have to be contiguous. 

    Most of the operating systems (for example Windows and Linux) use segmentation with paging. A process is divided into segments and individual segments have pages. 

    In partition allocation, when there is more than one partition freely available to accommodate a process’s request, a partition must be selected. To choose a particular partition, a partition allocation method is needed. A partition allocation method is considered better if it avoids internal fragmentation. 

    When it is time to load a process into the main memory and if there is more than one free block of memory of sufficient size then the OS decides which free block to allocate.

    There are different Placement Algorithm:

    1. First Fit: In the first fit, the partition is allocated which is the first sufficient block from the top of main memory. It scans memory from the beginning and chooses the first available block that is large enough. Thus it allocates the first hole that is large enough. 
       
      FIRST-FIT-300x225.png
      Figure \(\PageIndex{1}\): First Fit. ("First Fit" by deepakmkoshyGeeks for Geeks is licensed under CC BY-SA 4.0)
    2.  Best Fit Allocate the process to the partition which is the first smallest sufficient partition among the free available partition. It searches the entire list of holes to find the smallest hole whose size is greater than or equal to the size of the process. 
       
      BEST-FIT-300x225.png
      Figure \(\PageIndex{1}\): Best Fit. ("Best Fit" by deepakmkoshyGeeks for Geeks is licensed under CC BY-SA 4.0)
    3. Worst Fit Allocate the process to the partition which is the largest sufficient among the freely available partitions available in the main memory. It is opposite to the best-fit algorithm. It searches the entire list of holes to find the largest hole and allocate it to process.  
       
      WORST-FIT-300x225.png
      Figure \(\PageIndex{1}\): Worst Fit. ("Worst Fit" by deepakmkoshyGeeks for Geeks is licensed under CC BY-SA 4.0)
    4. Next Fit: Next fit is similar to the first fit but it will search for the first sufficient partition from the last allocation point. 

    Adapted from:
    "Partition Allocation Methods in Memory Management" by deepakmkoshyGeeks for Geeks is licensed under CC BY-SA 4.0

    • Was this article helpful?