For both fixed and dynamic memory allocation schemes, the operating system must keep list of each memory location noting which are free and which are busy. Then as new jobs come into the system, the free partitions must be allocated.
These partitions may be allocated by 4 ways:
1. First-Fit Memory Allocation 2. Best-Fit Memory Allocation 3. Worst-Fit Memory Allocation 4. Next-Fit Memory Allocation
These are Contiguous memory allocation techniques.
Best-Fit Memory Allocation:
This method keeps the free/busy list in order by size – smallest to largest. In this method, the operating system first searches the whole of the memory according to the size of the given job and allocates it to the closest-fitting free partition in the memory, making it able to use memory efficiently. Here the jobs are in the order from smalest job to largest job.
As illustrated in above figure, the operating system first search throughout the memory and allocates the job to the minimum possible memory partition, making the memory allocation efficient.
Advantages of Best-Fit Allocation :
Memory Efficient. The operating system allocates the job minimum possible space in the memory, making memory management very efficient. To save memory from getting wasted, it is the best method.
Disadvantages of Best-Fit Allocation :
It is a Slow Process. Checking the whole memory for each job makes the working of the operating system very slow. It takes a lot of time to complete the work.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Buddy Memory Allocation Program | Set 1 (Allocation)
- Difference between Static allocation and Stack allocation
- Difference between Static Allocation and Heap Allocation
- Resource Allocation Graph (RAG) in Operating System
- Allocation of frames in Operating System
- Non-Contiguous Allocation in Operating System
- First-Fit Allocation in Operating Systems
- Worst-Fit Allocation in Operating Systems
- Buddy System - Memory allocation technique
- System Protection in Operating System
- User View Vs Hardware View Vs System View of Operating System
- System Programs in Operating System
- File System Implementation in Operating System
- Xv6 Operating System -adding a new system call
- Traps and System Calls in Operating System (OS)
- File Allocation Methods
- MCQ on Memory allocation and compilation process
- Resource Allocation Techniques for Processes
- Buddy Memory Allocation Program | Set 2 (Deallocation)
- Channel Allocation Problem in Computer Network
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.