What Is Fragmentation,Segmentation,Compaction in OS.?
What Is Fragmentation, Segmentation, and Compaction in OS.?
As processes are loaded and removed from memory, the free memory space is broken into little pieces.
It happens after sometimes that processes can not be allocated to memory blocks considering their
small size and memory blocks remain unused. This problem is known as Fragmentation.
Fragmentation is of two types:

Total memory space is enough to satisfy a request or to
reside a process in it, but it is not contiguous so it can not be
used.
The memory block assigned to the process is bigger. Some portion of
memory is left unused as it can not be used by another
The user’s view of memory is not the same as the actual physical memory.
A program is a collection of segments. A segment is a logical unit such as the main program,
procedure, function, local variables, global variables, common block, stack, symbol table, arrays.

The logical address consists of two tuple:
<segment-number, offset>
Each entry of the segment table has a segment base and a segment limit.
The segment base contains the starting physical address where the segment resides in memory.
The segment limit specifies the length of the segment.
The segment table is an array of base-limit register pairs.

As a memory pool is allocated from, over time the pool will become fragmented.
Some objects from the pool will be allocated surrounded by objects that are not, in
seemingly random order. Memory compaction is the process of moving allocated
objects together and leaving empty space together.

1.Fragmentation
It happens after sometimes that processes can not be allocated to memory blocks considering their
small size and memory blocks remain unused. This problem is known as Fragmentation.
Fragmentation is of two types:

1 External fragmentation
Total memory space is enough to satisfy a request or to
reside a process in it, but it is not contiguous so it can not be
used.
2 Internal fragmentation
The memory block assigned to the process is bigger. Some portion of
memory is left unused as it can not be used by another
2.Segmentation
The user’s view of memory is not the same as the actual physical memory.
A program is a collection of segments. A segment is a logical unit such as the main program,
procedure, function, local variables, global variables, common block, stack, symbol table, arrays.

The logical address consists of two tuple:
<segment-number, offset>
Each entry of the segment table has a segment base and a segment limit.
The segment base contains the starting physical address where the segment resides in memory.
The segment limit specifies the length of the segment.
The segment table is an array of base-limit register pairs.

3. Compaction
As a memory pool is allocated from, over time the pool will become fragmented.
Some objects from the pool will be allocated surrounded by objects that are not, in
seemingly random order. Memory compaction is the process of moving allocated
objects together and leaving empty space together.

Comments
Post a Comment