Professional Documents
Culture Documents
Memory is divided into two parts, one for the operating system and one for the
user process. We usually want a few user processes to remain in memory at the
same time, so we need to consider how to share the memory available to those
processes waiting to be added to the memory.
In the continuous distribution of memory each process is contained in one part of
the memory linked to the section contained in the next process.
• Each process is assigned to an available loading process limited to a memory
block.
• All Arrived process is limited to this block, it cannot be stored partially in one
block and in part.
Simply put, a process cannot be saved in a memory system separated from another.
Multiple Partition Allocation
The memory blocks are available comprises set of blocks of various sizes
scattered throughout the memory.
When the process is arrived and it needs a memory to accommodate, the
system first searches the sets of blocks/Partition that is large enough to fit in
the arriving process.
If the block is too large, it will simply split the block into two partition and
one of the blocks is allotted to the arrived process.
Internal Fragmentation
External Fragmentation
1. Internal fragmentation
When the process is allotted to the memory, which is more than what is
required and after this process is accommodated it leaves some unused space
as one process should be allotted to only one block, not partially in one and
partially in another, that space remains unused.
2. External Fragmentation
When more than one process is allotted to the memory and one of them is
executed and removed from the memory then if the available blocks are not
contagious then they cannot be assigned to the future processes this problem
is called external fragmentation.
Allocation Algorithms
1. First Fit
In the first fit, the first block/Partition which is large enough to
accommodate the arriving process is allotted and after it finds it first
suitable block, it’s process to search ends.
Advantage
o It is the fastest algorithm since it searches as little as possible
Disadvantage
o After allocation if the remaining unused memory is too small it gets
wasted.
Example:
Process OS
A =25 kb
20 kb
Used
40 kb Hole = 40-25 = 15 kb
Used
60 kb
used
2. Best Fit
It allocated any free memory block that is closer or equal to required
process, this algorithm first searches entire block for free partition and as
well as for the small partition, closes to the required process.
Advantage
o Memory utilization is better.
Disadvantage
o It is slower.
OS
20 kb
Used
Example: 40 kb
Process
A =25 kb Used
25 kb
used
Hole = 25-25 = 0
3. Worst Fit
In worst fit, it allocates a large free block to a process so that after
accommodating, the remaining unused partition will be useful enough for
other arriving process.
Advantage
o Reduces the formation of small gaps between the memory
blocks/partition.
Disadvantage
o If the process that requires larger hole, then it cannot accommodate
since it is already accommodated by another smaller process.
Example:
Process
A =25 kb OS
20 kb
Used
40 kb
Used
60 kb Hole = 60-25 = 35 kb
used