What is the Difference Between Fragmentation and Segmentation? with Proper Definition and Brief Explanation
The main difference between fragmentation and pipeline is that the fragmentation is a condition that causes memory blocks to go unused whereas pipeline is the technique of dividing a process into multiple modules or sections. Fragmentation and Segmentation
Fragmentation and segmentation are two terms associated with memory management. Where, memory management is an important task performed by an operating system. It manages memory by moving processes between main memory and disk during execution. Certain memory locations can be allocated to a process or deallocated from a process. Therefore, the operating system maintains all the records of the memory locations of the processes. It also checks the amount of memory allocated to processes. Also, it decides which process should get the memory at what time. In addition, the operating system updates the state of the memory locations, that is, whether they are free or assigned to processes.
Key Areas Covered
1. What is fragmentation?
– Definition, Functionality
2. What is segmentation?
– Definition, Functionality
3. Difference Between Fragmentation and Segmentation?
– Key Differences Comparison
Key terms
External Fragmentation, Fragmentation, Internal Fragmentation, Memory Management, Operating System, Segmentation
What is fragmentation?
When executing a process, it is loaded into memory. After completion of execution, it is removed from memory. The process of loading and deleting creates free spaces in memory. These slots are small in size and cannot be allocated for some other process. Therefore, those memory blocks remain unused. It’s called fragmentation. There are two types of fragmentation called internal fragmentation and external fragmentation.
Internal fragmentation
In internal fragmentation, the memory block allocated to a process is larger than that required. Causes some memory to go unused. This space left cannot be allocated to another process. For example, if a process requires 2MB but is allocated a 3MB block of memory, then the 1MB block is left unused. This 1MB cannot be allocated to some other process, and is wasteful.
External fragmentation
In external fragmentation, the total memory space is enough to locate a process, but it is not contiguous. Therefore, that space remains unused. For example, suppose there is a 3 MB process and there are three memory blocks located in different memory locations. Those blocks cannot be used for the process as they are not contiguous. Random memory is a solution to this problem. It helps to place all the free memory space for a lactation.
What is segmentation?
Segmentation divides each process into several segments or sections of different sizes. A segment can be a main program, a function, stacks, symbol tables, data structures, etc. Each segment is a different logical address space in the program. These segments are of variable length size. In other words, the segments are not fixed in size.
When executing the program, each segment is loaded into non-contiguous memory. A reference to a segment’s memory location includes the segment number and offset. The operating system maintains a table called the segment map table. Also called the local descriptor table. This table stores records of each process and free memory blocks. It consists of the starting address (base address) and the length of each segment.
Difference Between Fragmentation and Segmentation
Definition
Fragmentation is a phenomenon where storage space is used inefficiently, resulting in reduced capacity or performance, and often both. Segmentation is the process of dividing the computer’s primary memory into segments or sections.
Functionality
Whereas fragmentation causes blocks of memory to go unused, segmentation works as a memory management technique for running processes.
Conclusion
Fragmentation and segmentation are associated with memory management. The difference between fragmentation and segmentation is that fragmentation is a condition that causes memory blocks to go unused whereas pipeline is the technique of dividing a process into multiple modules or sections.
Reference:
1. Introduction of segmentation | Operating System |, 4u Education, May 9, 2018, Available here.
2.”Operating System Memory Management.” Www.tutorialspoint.com, Tutorials Point, available here.
Courtesy image:
1. “Protected mode segments” By John Källén (jkl at commons) – Own work (Public Domain) via Commons Wikimedia