A process is divided into Segments. The chunks that a program is divided into which are not necessarily all of the same sizes are called segments. Segmentation gives user’s view of the process which paging does not give. Here the user’s view is mapped to physical memory.
There are types of segmentation:
- Virtual memory segmentation –
Each process is divided into a number of segments, not all of which are resident at any one point in time.
- Simple segmentation –
Each process is divided into a number of segments, all of which are loaded into memory at run time, though not necessarily contiguously.
There is no simple relationship between logical addresses and physical addresses in segmentation. A table stores the information about all such segments and is called Segment Table.
Segment Table – It maps two-dimensional Logical address into one-dimensional Physical address. It’s each table entry has:
- Base Address: It contains the starting physical address where the segments reside in memory.
- Limit: It specifies the length of the segment.
Translation of Two dimensional Logical Address to one dimensional Physical Address.
Address generated by the CPU is divided into:
- Segment number (s): Number of bits required to represent the segment.
- Segment offset (d): Number of bits required to represent the size of the segment.
Advantages of Segmentation –
- No Internal fragmentation.
- Segment Table consumes less space in comparison to Page table in paging.
Disadvantage of Segmentation –
- As processes are loaded and removed from the memory, the free memory space is broken into little pieces, causing External fragmentation.
This article has been contributed by Vikash Kumar. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- System Protection in Operating System
- Bad Block in Operating system
- Best-Fit Allocation in Operating System
- Functions of Operating System
- Paging in Operating System
- Multithreading in Operating System
- Introduction of Operating System - Set 1
- Thread in Operating System
- Inode in Operating System
- Deadlock Ignorance in Operating System
- Comparison on using Java for an Operating System instead of C
- Access matrix in Operating System
- Difference between Operating System and Kernel
- Banker's Algorithm in Operating System
- Virtual Machines in Operating System
Improved By : VaibhavRai3