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.
First-Fit Memory Allocation:
This method keeps the free/busy list of jobs organized by memory location, low-ordered to high-ordered memory. In this method, first job claims the first available memory with space more than or equal to it’s size. The operating system doesn’t search for appropriate partition but just allocate the job to the nearest memory partition available with sufficient size.
As illustrated above, the system assigns J1 the nearest partition in the memory. As a result, there is no partition with sufficient space is available for J3 and it is placed in the waiting list.
Advantages of First-Fit Memory Allocation:
It is fast in processing. As the processor allocates the nearest available memory partition to the job, it is very fast in execution.
Disadvantages of Fist-Fit Memory Allocation :
It wastes a lot of memory. The processor ignores if the size of partition allocated to the job is very large as compared to the size of job or not. It just allocates the memory. As a result, a lot of memory is wasted and many jobs may not get space in the memory, and would have to wait for another job to complete.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Best-Fit Allocation in Operating System
- Operating Systems | Input Output Systems | Question 5
- Allocation of frames in Operating System
- Non-Contiguous Allocation in Operating System
- Resource Allocation Graph (RAG) in Operating System
- Different Operating Systems
- Operating Systems | Set 8
- Operating Systems | Set 13
- Operating Systems | Set 14
- Operating Systems | Set 15
- Operating Systems | Set 10
- Operating Systems | Set 12
- Operating Systems | Set 11
- Operating Systems | Set 7
- Operating Systems | Set 9
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.