Difference Between Paging and Segmentation

Compare Paging and Segmentation

Paging and Segmentation Difference in Tabular Form

The key difference between paging and segmentation is that Paging was invented to get large address space without having to buy more physical memory. Segmentation was invented to allow programs and data to be broken up into logically independent address space and to add sharing and protection.

Comparison Chart

Paging Segmentation
Paging was invented to get large address space without having to buy more physical memory. Segmentation was invented to allow programs and data to be broken up into logically independent address space and to add sharing
and protection.
The programer does not aware that paging is used. The programer is aware that segmentation is
used.
Address space is one dimensional. Many independent address spaces are there.
Procedure and data cannot be distinguished
and protected separately.
Procedure and data
be distinguished and protected separately.
Change in data or procedure requires
compiling entire program.
Change in data or procedure requires compiling
only affected segment, not the entire program.
Sharing of different procedures not available. Sharing of different procedures available.
No separate protection Separate protection
No separate compiling Separate compiling
No Share Code Share code

Paging

  • The program generated address is called as Virtual Addresses and form the Virtual Address Space.
  • Most virtual memory systems use a technique called paging.
  • Virtual address space is divided into fixed-size partitions called pages.
  • The corresponding units in physical memory are called page frames.
  • The pages and page frames are always of the same size.
  • Size of Virtual Address Space is greater than that of Main memory, so instead of loading entire address space into memory to run the process, MMU copies only required pages into main memory.
  • In order to keep the track of pages and page frames, OS maintains a data structure called page table.

Segmentation

  • A general solution is to provide the machine with many independent address spaces called segments.
  • Each segment consists of a linear sequence of addresses, from 0 to the maximum allowed.
  • Different Segments may have different lengths.
  • Segment lengths may change during execution.
  • Different Segments can grow or shrink independently without affecting each other.
  • To specify the address in these segments or two-dimensional memories, the program must supply a two-part address, a segment number, and address within the segment.

Advantages of Segmentation

  • Segmentation provides simplified data structure to handle the growing and shrinking of data.
  • If each procedure occupies a separate segment, with address 0 as its starting address, the linking of procedures compiled separately is simplified.
  • If the procedure in segment n is modified and recompiled, no other procedures need to be changed.
  • Segmentation also facilitates sharing procedures or data between several processes. A common example is a shared library.
  • Each segment forms a logical entity of which the programmer is aware, such as procedure, or an array, or a stack, different segments can have a different kind of protection.
  • In paging system programmer is unaware of the content of pages, but in segmentation, the user knows in advance the content of the segments

Related Differences:

LEAVE A REPLY

Please enter your comment!
Please enter your name here