Basically, the allocation algorithm is the algorithms with help to allocate the process in the operating system.
So, there are four allocation algorithm:-
Example:-
In this algorithm start the search from the starting of the list for a free place or hole to allocate the new process P 1 = 15 K. And when it free a hole it allocate it on the first get hole.
ADVANTAGE OF FIRST FIT
So, there are four allocation algorithm:-
- First fit
- Best fit
- Worst fit
- Next fit
1. First fit
The first fit start searching from starting of the list and it allocates the process to the first free holeExample:-
In this algorithm start the search from the starting of the list for a free place or hole to allocate the new process P 1 = 15 K. And when it free a hole it allocate it on the first get hole.
ADVANTAGE OF FIRST FIT
- It is a faster algorithm because it searches as little as possible.
DISADVANTAGE OF FIRST FIT
- This technique suffers from the problem that the remaining/unused memory area left after allocation becomes smaller. Thus request for larger memory requirements can't accommodate.
2. Best fit
This algorithmic program searches the complete list of free partitions and takes the tiniest hole that's adequate.
OR
It tries to find a hole that is close to the actual process size needed.
EXAMPLE:-
In the best fit, we choose that free space or hole in which if we allocate a process than the left hole or free space would be as much as less.
So, if we talk about this example than there are two holes are there in the diagram
first is of 20K hole
and second is of 30 K hole
SO,
left space = hole - P 1
ADVANTAGE OF BEST FIT
- Memory utilization is best than the primary match because it searches the tiniest free partition.
DISADVANTAGE OF BEST FIT
- It is slower.
- It may tend to fill up memory with tiny useless holes.
3. Worst fit
- Worst fit takes the largest available free portion so that the portion is broken off will be big enough to be useful.
- It is the reverse of the best fit.
- It is the reverse of the best fit.
DISADVANTAGE OF WORST FIT
- A process requiring larger memory arriving at a later stage cannot be accommodated as the latest hole is already cannot be accommodated as the largest hole is already split and occupied.
4. Next fit
The next fit is a modification of the first fit. It begins as the first fit to find a free partition. When called next time it starts searching from where it left off and not from the beginning.
Post a Comment
Post a Comment