Monday 9 November 2020

What is Compaction in OS?

 

Compaction:

 

Compaction is a technique of collecting all the free space together in one block. This block or partition can be allotted to some other jobs. For ex: consider the following fig.



Memory representation(a)

Fig (a): Memory representation


The total internal fragmentation in this scheme is (100 + 75 + 75 = 250). The total external fragmentation is 400 + 350 + 625 = 1375 KB. Collect the internal and external fragmentation together in one block (250 + 1375 = 1625 KB). This type of mechanism is said to be compaction. Now the compacted memory is 1625 KB.

 

Consider the below fig. Now, the scheduler can load job J3 (1200 KB) in compacted memory. So, efficient memory utilization is possible using compaction.

Compacted memory

Fig (b): Compacted memory


No comments:

Post a Comment