0% found this document useful (0 votes)
4 views2 pages

CONTIGUOUS MEMORY ALLOCATION

Contiguous memory allocation assigns memory to processes in adjacent blocks, utilizing three methods: First Fit, Best Fit, and Worst Fit. First Fit allocates the first sufficiently large free partition, Best Fit selects the smallest adequate partition, and Worst Fit uses the largest available partition. Each method has its advantages and disadvantages regarding speed, fragmentation, and memory efficiency.

Uploaded by

ollahmagara
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

CONTIGUOUS MEMORY ALLOCATION

Contiguous memory allocation assigns memory to processes in adjacent blocks, utilizing three methods: First Fit, Best Fit, and Worst Fit. First Fit allocates the first sufficiently large free partition, Best Fit selects the smallest adequate partition, and Worst Fit uses the largest available partition. Each method has its advantages and disadvantages regarding speed, fragmentation, and memory efficiency.

Uploaded by

ollahmagara
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Contiguous Allocation

Contiguous memory allocation involves allocating memory to processes in contiguous


blocks, where the starting address of each block is adjacent to the previous one. The three
cases of contiguous memory allocation: First Fit, Best Fit, and Worst Fit.

First Fit
In the first-fit, operating system searches for the first free partition that is large enough to
accommodate the process. The operating system starts searching from the beginning of the
memory and allocates the first free partition that is large enough to fit the process.
Example:
Let’s assume the memory has the following free blocks:
[100 KB, 500 KB, 200 KB, 300 KB, 600 KB]
A process of 250 KB requests memory.

-The OS starts searching from the beginning.


-100 KB is too small.
-500 KB is large enough, so the process is placed in this block.
-Remaining 250 KB is left free

Best Fit
The best-fit algorithm searches for the smallest free partition that is large enough to
accommodate the process. The operating system searches the entire memory and selects the
free partition that is closest in size to the process. If an exact fit is found, no memory is
wasted.
Example:
Using the same free blocks:
[100 KB, 500 KB, 200 KB, 300 KB, 600 KB]
A 250 KB process needs memory.
-The OS looks at all available blocks and finds that 300 KB is the closest match.
-The process is placed in the 300 KB block.
-50 KB remains free.
Worst Fit
The worst-fit algorithm searches for the largest free partition and allocates the process to it.
This algorithm is designed to leave the largest possible free partition for future use.
Example:
Using the same free blocks:
[100 KB, 500 KB, 200 KB, 300 KB, 600 KB]
A 250 KB process needs memory.

-The OS selects the 600 KB block (largest block available).


-The process is placed in this block.
-Remaining 350 KB is left free.
Pros and Cons
First Fit is fast and simple to implement, making it the most commonly used algorithm.
However, it can suffer from external fragmentation, where small free partitions are left
between allocated partitions.

Best Fit reduces external fragmentation by allocating processes to the smallest free partition,
but it requires more time to search for the appropriate partition.

Worst Fit reduces external fragmentation by leaving the largest free partition, but it can lead
to inefficient use of memory.

You might also like