1 / 7

Chapter 16 Segmentation

Chapter 16 Segmentation. Chien -Chung Shen CIS, UD cshen@cis.udel.edu. Support Large Address Space. With base and bounds registers, MMU could relocate the entire address space to different parts of physical memory Any thing you don’t like? F ree ( unused) space between heap and stack

betsy
Download Presentation

Chapter 16 Segmentation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 16Segmentation Chien-Chung Shen CIS, UD cshen@cis.udel.edu

  2. Support Large Address Space • With base and bounds registers, MMU could relocate the entire address space to different parts of physical memory • Any thing you don’t like? • Free (unused) space between heap and stack • Solution: segmentation[base-bounds pair for each logical segment (e.g., code, heap, stack) of the address space allow them to be places in different parts of physical memory]

  3. Segmentation • Only used memory is allocated space in physical memory • A set of base and bounds registers • Segment Base Size • Code 32K 2K • Heap 34K 2K • Stack 28K 2K • Notion of offset • Virtual address 100 ? • 32K = 32768 • within code: 32868 • Virtual address 4200 ? • 34K = 34816 • within heap: 34920 • Segmentation fault: refer to illegal address

  4. Mechanism • Explicit approach • 3 segments: 2 bits • e.g., 4200 • offset < bound (OK) • Implicit approach: based on how address is formed • from CPU (program counter) -> code • based on stack pointer -> stack • else -> heap

  5. Stack – Grow Backward • Segment Base Size Grows Positive Code 32K 2K 1 Heap 34K 2K 1 Stack 28K 2K 0 • VA 15KB -> 27KB 11 1100 0000 0000

  6. Sharing • Sharecertain memory segments between address spaces: codesegment • Protection bits per segment indicating R, W, X • Segment Base Size Grows Positive Protection Code 32K 2K 1 R-X Heap 34K 2K 1 R-W Stack 28K 2K 0 R-W

  7. OS Support • Context switching • segment registers must be saved/restored • Managing free space in physical memory • external fragmentation (holes of free space) • compaction

More Related