Paging and Segmentation: BY, Shubha B. 1PI08LDS16
Paging and Segmentation: BY, Shubha B. 1PI08LDS16
BY,
Shubha B.
1PI08LDS16
Logical vs. Physical Address Space
• Logical address – generated by the CPU; also referred to as
virtual address.
• 2n > number of pages in process => n bits to hold the page number
• Logical address is nm
• Physical address is simply km where k is the frame that stores
page “n”
Paging Example
Paging Example
• Page size 4 bytes.
• No external fragmentation
• Any page can be placed in any frame in physical memory
• Page tables are fairly large , so page tables are too big to fit in
registers, so they must live in physical Memory.
• Segmentation Example:
Address Translation
Sharing of Segments
• Segments are shared when entries in the segment tables of
two different processes point to the same physical locations.
• Advantages:
– Each segment can be
• located independently
• separately protected
• grow independently
– Segments can be shared between processes.
– Eliminate the fragmentation.
• Disadvantages:
– Allocation algorithms as for memory partitions
– External fragmentation, back to compaction problem.
• Solution: combine segmentation and paging.
Segmentation vs. Paging
Does not supports the user view of Supports the user view of memory
memory
Processor uses the page number and Processor uses the segment number and
displacement to calculate absolute displacement to calculate absolute
address. address.
Multilevel paging is possible Multilevel segmentation is possible. But
no use.
• Similarity:
– Address space can exceed size of real memory.
• Differences:
– Programmer is aware of segmentation. Paging is hidden.
– Segmentation maintains multiple address spaces per
process. Paging maintains one address space.
– Segmentation allows procedures and data to be separately
protected. This is hard with paging.