Difference between Paging and Segmentation
Paging
- Paging is the memory management scheme in which the physical memory allocated to a process is non contiguous.
- In this approach, physical memory is divided into fixed size blocks called frames and the logical memory is divided into fixed size blocks called pages.
- The size of a page is same as that of a frame.
Page Size = Frame Size
- Whenever a process is to be executed, its pages are placed or loaded into any available memory frames. It means a page mapped into a frame.
- Individual pages and frames are recognized by unique numbers as page number and frame number respectively.
- Thus, a page number forms a part of logical address and a frame number forms a part of a physical address.
Segmentation
- Segmentation is a memory management technique in which process is dividing into the segments and the segments are of variable size.
- The details about each segment are stored in a table called a segment table. Segment table is stores mainly two information of the segments.
- Base: It is the base address of the segment.
- Limit: It is the length of the segment.
Comparison between Paging and Segmentation
- Paging is our main memory management technique. Paging is more close to the Operating system . It divides all the processes into the form of pages regardless of the fact that a process can have some relative parts of functions which need to loaded in the same page. Segmentation not provide user view of the process. It decreases the efficiency of the system.
- On the other hand segmentation which divides the process into the segments. Each segment contains the same type of functions such as the main function can included in one segment and the library functions can included in the other segment.
Difference between Segmentation and Paging
Paging | Segmentation |
Paging is memory management technique in which the logical memory is divided into fixed sized blocks called pages. | Segmentation is a memory management technique is which the logical memory is divided into variable sized blocks called segments. |
The size of pages is always equal. | The size of segment is variable. |
The mapping of logical address to physical address is provided by a page table. | The mapping of logical address to physical address is provided by a segment table. |
The page table contains the base address of each page in physical memory. | The segment table contains a base address of each segment in physical memory and segments limit i.e. length of each segment. |
In paging, the logical address consists of a page number and a page offset. | In segmentation, logical address consists of a segment number and an offset. |
Paging manages the memory as linear array of bytes and user cannot think in that environment. | Segmentation manages the memory as segments say one for global variables, one for a function, one for local variables, one for stack etc. i.e. in the way user thinks of a memory. |
Programmer is unaware of paging. | It is based on the programmer’s point of view. |
In paging it is not possible to provide separate protection for instructions and data. | One for each segment separately and allows each table to grow or shrink separately. |
In paging, procedure sharing is not possible. | The procedures can easily shared between different processes as they maintained as different segments. |
It results in elimination of fragmentation problem. | It may lead to fragmentation as segments of different sizes need to swapped again and again. |
Paging maintains one address space for the process. | It maintains multiple address spaces per process segment. |