Compaction

As we know, fixed and dynamic partitioning suffers from external fragmentation. However, this issue can overcome through Compaction.

In compaction, all the holes are made contiguous and all the loaded processes in different partitions are brought together  by OS. 

Now merged holes can accommodate new processes according to their needs. This method is also known as de-fragmentation. Let us explain through diagram

compaction

After compaction the process P8 can be loaded into main memory easily because contiguous space is available now.

Problems with Compaction

Efficiency of the system also decrease because CPU set idle at the time of compaction.

Explanation: At the time of compaction, CPU stops execution of current process because it will resume the process from somewhere else after compaction. If CPU does not stop the execution of a process then it may execute the instructions from somewhere else locations instead of next instruction of same process in memory.

Note: Consider an OS require 6 NS time to transfer 1-B then, 1 MB transfer needs (1 X 2^20) X (6 X 10 ^ -9) seconds.

So, large the amount of data to transfer, require a huge amount of time.

1. Complex Memory Allocation

In Fixed partitioning, the list of partitions is made once and will never change.

As allocation and de-allocation takes place very frequently in dynamic memory allocation. So, partition size also change each time in allocation and de-allocation. That’s why, it is very difficult for OS to manage everything at a time.

How to manage allocation and de-allocation?

OS use the following data structures for memory allocation and de-allocation.

Both of these concepts, we will discuss in the next post.

If It Is Useful Then Help Other’s By Sharing…

Help Other’s By Sharing…

Contact Us

Burewala, Vehari, Punjab, Pakistan

cstaleem1@gmail.com

Website: CStaleem.com

Pin It on Pinterest