Successfully reported this slideshow.
SegmentationCS 537 – Introduction to Operating Systems
Segmentation• Segmentation is a technique for breaking memory  up into logical pieces• Each “piece” is a grouping of relat...
Segmentation      P1 data                              P2 code                     print                     function     ...
Addressing Segments• Let’s first assume no paging in the system• User generates logical addresses• These addresses consist...
Addressing Segments                                     limit         base    S             ological address              ...
Segmentation Hardware• Sounds very similar to paging• Big difference – segments can be variable in size• As with paging, t...
Protection and Sharing• Like page tables, each process usually gets  its own segment table• Unlike page tables, there usua...
Protection and Sharing limit base                   2000 1000 200                   12001 3500 9000                       ...
Segmentation Issues• Entire segment is either in memory or on  disk• Variable sized segments leads to external  fragmentat...
Segmentation with Paging• Most architectures support segmentation and  paging• Basic idea,   – segments exist in virtual a...
Linear Address• The base address gotten from the segment  descriptor table is concatenated with the  offset• This new addr...
virtual address from user      descriptor              offset             limit   base                     +             s...
Upcoming SlideShare
Loading in …5
×

Segmentation geekssay.com

594 views

Published on

Segmentation PPT shared by: geekssay.com

Published in: Education
  • Be the first to comment

Segmentation geekssay.com

  1. 1. SegmentationCS 537 – Introduction to Operating Systems
  2. 2. Segmentation• Segmentation is a technique for breaking memory up into logical pieces• Each “piece” is a grouping of related information – data segments for each process – code segments for each process – data segments for the OS – etc.• Like paging, use virtual addresses and use disk to make memory look bigger than it really is• Segmentation can be implemented with or without paging
  3. 3. Segmentation P1 data P2 code print function P2 data P1 codeOS Code OS data OS stack logical address space
  4. 4. Addressing Segments• Let’s first assume no paging in the system• User generates logical addresses• These addresses consist of a segment number and an offset into the segment• Use segment number to index into a table• Table contains the physical address of the start of the segment – often called the base address• Add the offset to the base and generate the physical address – before doing this, check the offset against a limit – the limit is the size of the segment
  5. 5. Addressing Segments limit base S ological address segment table yes Physical Address o < limit + no error
  6. 6. Segmentation Hardware• Sounds very similar to paging• Big difference – segments can be variable in size• As with paging, to be effective hardware must be used to translate logical address• Most systems provide segment registers• If a reference isn’t found in one of the segment registers – trap to operating system – OS does lookup in segment table and loads new segment descriptor into the register – return control to the user and resume• Again, similar to paging
  7. 7. Protection and Sharing• Like page tables, each process usually gets its own segment table• Unlike page tables, there usually exists a global segment table for everyone – this, however, is usually used by OS• Access rights for segment are usually included in table entry• Multiple processes can share a segment
  8. 8. Protection and Sharing limit base 2000 1000 200 12001 3500 9000 2000 LDT limit base 2300 0 500 2500 2500 1 9000 20000 3000 GDT 9000 limit base0 1000 2001 300 2000 12500 LDT
  9. 9. Segmentation Issues• Entire segment is either in memory or on disk• Variable sized segments leads to external fragmentation in memory• Must find a space big enough to place segment into• May need to swap out some segments to bring a new segment in
  10. 10. Segmentation with Paging• Most architectures support segmentation and paging• Basic idea, – segments exist in virtual address space – base address in segment descriptor table is a virtual address – use paging mechanism to translate this virtual address into a physical address• Now an entire segment does not have to be in memory at one time – only the part of the segment that we need will be in memory
  11. 11. Linear Address• The base address gotten from the segment descriptor table is concatenated with the offset• This new address is often referred to as a linear address• This is the address that is translated by the paging hardware
  12. 12. virtual address from user descriptor offset limit base + segment table linear address directory page offset page frame PT directory page tabledirectory base

×