Skip to content
Related Articles
Open in App
Not now

Related Articles

Paged Segmentation and Segmented Paging

Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 21 Sep, 2021
Improve Article
Save Article

Major Limitation of Single Level Paging
A big challenge with single level paging is that if the logical address space is large, then the page table may take up a lot of space in main memory. For instance, consider that logical address is 32 bit and each page is 4 KB, the number of pages will be 2^20 pages. The page table without additional bits will be of the size 20 bits * 220 or 2.5 MB. Since each process has its own page table, a lot of memory will be consumed when single level paging is used. For a system with 64-bit logical address even a page table of single process will not fit in main memory. For a process with a large logical address space, a lot of its page table entries are invalid as a lot of the logical address space goes unused.

Page table with invalid entries

Segmented Paging
A solution to the problem is to use segmentation along with paging to reduce the size of page table. Traditionally, a program is divided into four segments, namely code segment, data segment, stack segment and heap segment.

Segments of a process

The size of the page table can be reduced by creating a page table for each segment. To accomplish this hardware support is required. The address provided by CPU will now be partitioned into segment no., page no. and offset.

The memory management unit (MMU) will use the segment table which will contain the address of page table(base) and limit. The page table will point to the page frames of the segments in main memory.

Segmented Paging

Advantages of Segmented Paging

  1. The page table size is reduced as pages are present only for data of segments, hence reducing the memory requirements.
  2. Gives a programmers view along with the advantages of paging.
  3. Reduces external fragmentation in comparison with segmentation.
  4. Since the entire segment need not be swapped out, the swapping out into virtual memory becomes easier .

Disadvantages of Segmented Paging

  1. Internal fragmentation still exists in pages.
  2. Extra hardware is required
  3. Translation becomes more sequential increasing the memory access time.
  4. External fragmentation occurs because of varying sizes of page tables and varying sizes of segment tables in today’s systems.

Paged Segmentation

  1. In segmented paging, not every process has the same number of segments and the segment tables can be large in size which will cause external fragmentation due to the varying segment table sizes. To solve this problem, we use paged segmentation which requires the segment table to be paged. The logical address generated by the CPU will now consist of page no #1, segment no, page no #2 and offset.
  2. The page table even with segmented paging can have a lot of invalid pages. Instead of using multi level paging along with segmented paging, the problem of larger page table can be solved by directly applying multi level paging instead of segmented paging.

Paged Segmentation

Advantages of Paged Segmentation

  1. No external fragmentation
  2. Reduced memory requirements as no. of pages limited to segment size.
  3. Page table size is smaller just like segmented paging,
  4. Similar to segmented paging, the entire segment need not be swapped out.

Disadvantages of  Paged Segmentation

  1. Internal fragmentation remains a problem.
  2. Hardware is complexer than segmented paging.
  3. Extra level of paging at first stage adds to the delay in memory access.
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!