The Wayback Machine - https://web.archive.org/web/20240812101236/https://www.geeksforgeeks.org/worst-fit-allocation-in-operating-systems/
Open In App

Worst-Fit Allocation in Operating Systems

Last Updated : 03 Feb, 2021
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

For both fixed and dynamic memory allocation schemes, the operating system must keep a 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 in 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. 

Worst-Fit Memory Allocation : 
In this allocation technique, the process traverses the whole memory and always search for the largest hole/partition, and then the process is placed in that hole/partition. It is a slow process because it has to traverse the entire memory to search the largest hole. 

Here is an example to understand Worst Fit-Allocation – 

Here Process P1=30K is allocated with the Worst Fit-Allocation technique, so it traverses the entire memory and selects memory size 400K which is the largest, and hence there is an internal fragmentation of 370K which is very large and so many other processes can also utilize this leftover space. 

Advantages of Worst-Fit Allocation : 
Since this process chooses the largest hole/partition, therefore there will be large internal fragmentation. Now, this internal fragmentation will be quite big so that other small processes can also be placed in that leftover partition. 

Disadvantages of Worst-Fit Allocation : 
It is a slow process because it traverses all the partitions in the memory and then selects the largest partition among all the partitions, which is a time-consuming process.
 


Previous Article
Next Article

Similar Reads

First-Fit Allocation in Operating Systems
INTRODUCTION: First-Fit Allocation is a memory allocation technique used in operating systems to allocate memory to a process. In First-Fit, the operating system searches through the list of free blocks of memory, starting from the beginning of the list, until it finds a block that is large enough to accommodate the memory request from the process.
3 min read
Best-Fit Allocation in Operating System
INTRODUCTION: Best-Fit Allocation is a memory allocation technique used in operating systems to allocate memory to a process. In Best-Fit, the operating system searches through the list of free blocks of memory to find the block that is closest in size to the memory request from the process. Once a suitable block is found, the operating system spli
4 min read
Difference between Static Allocation and Heap Allocation
Static Allocation v/s Heap Allocation Static Allocation: Static allocation is an allocation procedure that is used for the allocation of all the data objects at compile time. In this type of allocation, allocation of data objects is done at compile time only. As in static allocation, the compiler decides the extent of storage which cannot be change
3 min read
Buddy Memory Allocation Program | Set 1 (Allocation)
Prerequisite - Buddy System Question: Write a program to implement the buddy system of memory allocation in Operating Systems.Explanation - The buddy system is implemented as follows- A list of free nodes, of all the different possible powers of 2, is maintained at all times (So if total memory size is 1 MB, we'd have 20 free lists to track-one for
13 min read
Difference between Static allocation and Stack allocation
Static Allocation: Static allocation is a procedure which is used for allocation of all the data objects at compile time. Static allocation is possible only when the compiler knows the size of data object at compile time. In this type of allocation, formation of data objects is not possible under any circumstances at run time. In static allocation,
2 min read
Operating Systems | Input Output Systems | Question 5
Which of the following is major part of time taken when accessing data on the disk? (A) Settle time (B) Rotational latency (C) Seek time (D) Waiting time Answer: (C) Explanation: Seek time is time taken by the head to travel to the track of the disk where the data to be accessed is stored.Quiz of this Question
1 min read
Allocation of frames in Operating System
An important aspect of operating systems, virtual memory is implemented using demand paging. Demand paging necessitates the development of a page-replacement algorithm and a frame allocation algorithm. Frame allocation algorithms are used if you have multiple processes; it helps decide how many frames to allocate to each process. There are various
3 min read
Resource Allocation Graph (RAG) in Operating System
As Banker's algorithm using some kind of table like allocation, request, available all that thing to understand what is the state of the system. Similarly, if you want to understand the state of the system instead of using those table, actually tables are very easy to represent and understand it, but then still you could even represent the same inf
5 min read
Non-Contiguous Allocation in Operating System
Non-contiguous allocation, also known as dynamic or linked allocation, is a memory allocation technique used in operating systems to allocate memory to processes that do not require a contiguous block of memory. In this technique, each process is allocated a series of non-contiguous blocks of memory that can be located anywhere in the physical memo
6 min read
Operating Systems - GATE CSE Previous Year Questions
Solving GATE Previous Year's Questions (PYQs) not only clears the concepts but also helps to gain flexibility, speed, accuracy, and understanding of the level of questions generally asked in the GATE exam, and that eventually helps you to gain good marks in the examination. Previous Year Questions help a candidate practice and revise for GATE, whic
4 min read
three90RightbarBannerImg