The Operating System allocates resources when a program need them. When the program terminates, the resources are de-allocated, and allocated to other programs that need them. Now the question is, what strategy does the operating system use to allocate these resources to user programs?
There are two Resource allocation techniques:
Resource partitioning approach –
In this approach, the operating system decides beforehand, that what resources should be allocated to which user program. It divides the resources in the system to many resource partitions, where each partition may include various resources – for example, 1 MB memory, disk blocks, and a printer.
Then, it allocates one resource partition to each user program before the program’s initiation. A resource table records the resource partition and its current allocation status (Allocated or Free).
- Easy to Implement
- Less Overhead
- Lacks flexibility – if a resource partition contains more resources than what a particular process requires, the additional resources are wasted.
- If a program needs more resources than a single resource partition, it cannot execute (Though free resources are present in other partitions).
An example resource table may look like:
Pool based approach –
In this approach, there is a common pool of resources. The operating System checks the allocation status in the resource table whenever a program makes a request for a resource. If the resource is free, it allocates the resource to the program.
- Allocated resources are not wasted.
- Any resource requirement can be fulfilled if the resource is free (unlike Partitioning approach)
- Overhead of allocating and de-allocating the resources on every request and release.
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.
- Resource Allocation Graph (RAG) in Operating System
- Resource Allocation
- Buddy Memory Allocation Program | Set 1 (Allocation)
- Difference between Static allocation and Stack allocation
- Difference between Static Allocation and Heap Allocation
- Get/Set process resource limits in C
- Drawback of Resource Preemption
- Resource Reservation Protocol in Real-time Systems
- Zombie Processes and their Prevention
- Reasons for Processes Termination
- Concurrent Processes in Operating System
- Operations on Processes
- Program for FCFS CPU Scheduling | Set 2 (Processes with different arrival times)
- Find the order of execution of given N processes in Round Robin Scheduling
- File Allocation Methods
- MCQ on Memory allocation and compilation process
- Buddy System - Memory allocation technique
- Allocation of frames in Operating System
- Non-Contiguous Allocation in Operating System
- Buddy Memory Allocation Program | Set 2 (Deallocation)
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.
Improved By : Harshit kalal