Segmentation

CS 537 – Introduction to Operating Systems
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
Segmentation

      P1 data                              P2 code

                     print
                     function
                                     P2 data
   P1 code



OS Code             OS data               OS stack


             logical address space
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
Addressing Segments

                                     limit         base
    S             o

logical address


                                          segment table




                                    yes                   Physical Address
                        o < limit                    +

                        no

                         error
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
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
Protection and Sharing

 limit base                   200
0 1000 200                   1200
1 3500 9000
                             2000
    LDT        limit base
                             2300
              0 500   2500   2500
              1 9000 20000   3000

                  GDT        9000
 limit base
0 1000 200
1 300 2000
                             12500
    LDT
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
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
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
virtual address from user
      descriptor              offset




             limit   base                     +




             segment table

                 linear address   directory        page        offset
                                                                        page frame
                 PT directory                     page table




directory base

More Related Content

PPTX
Presentation on Segmentation
PPTX
Paging and Segmentation
PPT
Os Swapping, Paging, Segmentation and Virtual Memory
PDF
Main Memory
PPTX
Paging and segmentation
PPTX
Segmentation in Operating Systems.
PPT
Paging and Segmentation
PPT
Ch9 OS
 
Presentation on Segmentation
Paging and Segmentation
Os Swapping, Paging, Segmentation and Virtual Memory
Main Memory
Paging and segmentation
Segmentation in Operating Systems.
Paging and Segmentation
Ch9 OS
 

What's hot (20)

PPT
Memory+management
PPT
Memory management
PPTX
Paging and Segmentation in Operating System
PPT
Csc4320 chapter 8 2
PPT
Memory Management
PPT
Mca ii os u-4 memory management
PPTX
Memory management
PPT
Computer memory management
PPTX
Paging,Segmentation & Segment with Paging
PPTX
Introduction of Memory Management
PPTX
Combined paging and segmentation
PPT
34 single partition allocation
PPTX
Operating system paging and segmentation
PDF
Memory Management
PPTX
Memory management
PPTX
Operation System
PPT
Memory management
PPTX
Memory management
Memory+management
Memory management
Paging and Segmentation in Operating System
Csc4320 chapter 8 2
Memory Management
Mca ii os u-4 memory management
Memory management
Computer memory management
Paging,Segmentation & Segment with Paging
Introduction of Memory Management
Combined paging and segmentation
34 single partition allocation
Operating system paging and segmentation
Memory Management
Memory management
Operation System
Memory management
Memory management
Ad

Similar to Segmentation geekssay.com (20)

PPT
Segmentation
DOCX
PAGIN AND SEGMENTATION.docx
PPT
os presentation.ppt
PPTX
Segmentation
PDF
Memory Management Strategies - III.pdf
PPT
10 instruction sets characteristics
PPTX
Lecture-7 Main Memroy.pptx
PPT
Operating systems- Main Memory Management
PDF
Ch8 main memory
PPT
08 operating system support
PPT
Unit 4_ Memory Management Memory ManagementMemory ManagementMemory Management...
PPTX
Anshika 1111.pptx
PPT
08 operating system support
PPT
08 operating system support
PPTX
Main Memory
PDF
Memory Management.pdf
PDF
Deep Dive into DynamoDB
PPT
10 instruction sets characteristics
Segmentation
PAGIN AND SEGMENTATION.docx
os presentation.ppt
Segmentation
Memory Management Strategies - III.pdf
10 instruction sets characteristics
Lecture-7 Main Memroy.pptx
Operating systems- Main Memory Management
Ch8 main memory
08 operating system support
Unit 4_ Memory Management Memory ManagementMemory ManagementMemory Management...
Anshika 1111.pptx
08 operating system support
08 operating system support
Main Memory
Memory Management.pdf
Deep Dive into DynamoDB
10 instruction sets characteristics
Ad

More from Hemant Gautam (8)

PPS
Make a fool geekssay.com sharing
PPS
1 men die-younger geekssay.com sharing
PPT
Shopping cart project geekssay.com
PPT
Atm traffic management geekssay.com
PPT
Disk scheduling geekssay.com
PPT
Kruskals prims shared by: geekssay.com
PPT
Knapsack Algorithm www.geekssay.com
PPTX
College Monitoring system BY: Geekssay.com
Make a fool geekssay.com sharing
1 men die-younger geekssay.com sharing
Shopping cart project geekssay.com
Atm traffic management geekssay.com
Disk scheduling geekssay.com
Kruskals prims shared by: geekssay.com
Knapsack Algorithm www.geekssay.com
College Monitoring system BY: Geekssay.com

Recently uploaded (20)

PPSX
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
PPTX
PAIN PATHWAY & MANAGEMENT OF ACUTE AND CHRONIC PAIN SPEAKER: Dr. Rajasekhar ...
PPTX
Ppt obs emergecy.pptxydirnbduejguxjjdjidjdbuc
PDF
African Communication Research: A review
PPTX
Unit1_Kumod_deeplearning.pptx DEEP LEARNING
PPTX
Neurological complocations of systemic disease
PPTX
GW4 BioMed Candidate Support Webinar 2025
PDF
Chevening Scholarship Application and Interview Preparation Guide
PDF
GSA-Past-Papers-2010-2024-2.pdf CSS examination
PDF
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
PPTX
UCSP Section A - Human Cultural Variations,Social Differences,social ChangeCo...
PDF
WHAT NURSES SAY_ COMMUNICATION BEHAVIORS ASSOCIATED WITH THE COMP.pdf
DOCX
HELMET DETECTION AND BIOMETRIC BASED VEHICLESECURITY USING MACHINE LEARNING.docx
PPTX
climate change of delhi impacts on climate and there effects
PDF
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
PDF
Unleashing the Potential of the Cultural and creative industries
PDF
FAMILY PLANNING (preventative and social medicine pdf)
PDF
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
PPTX
Key-Features-of-the-SHS-Program-v4-Slides (3) PPT2.pptx
PPTX
Diploma pharmaceutics notes..helps diploma students
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
PAIN PATHWAY & MANAGEMENT OF ACUTE AND CHRONIC PAIN SPEAKER: Dr. Rajasekhar ...
Ppt obs emergecy.pptxydirnbduejguxjjdjidjdbuc
African Communication Research: A review
Unit1_Kumod_deeplearning.pptx DEEP LEARNING
Neurological complocations of systemic disease
GW4 BioMed Candidate Support Webinar 2025
Chevening Scholarship Application and Interview Preparation Guide
GSA-Past-Papers-2010-2024-2.pdf CSS examination
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
UCSP Section A - Human Cultural Variations,Social Differences,social ChangeCo...
WHAT NURSES SAY_ COMMUNICATION BEHAVIORS ASSOCIATED WITH THE COMP.pdf
HELMET DETECTION AND BIOMETRIC BASED VEHICLESECURITY USING MACHINE LEARNING.docx
climate change of delhi impacts on climate and there effects
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
Unleashing the Potential of the Cultural and creative industries
FAMILY PLANNING (preventative and social medicine pdf)
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
Key-Features-of-the-SHS-Program-v4-Slides (3) PPT2.pptx
Diploma pharmaceutics notes..helps diploma students

Segmentation geekssay.com

  • 1. Segmentation CS 537 – Introduction to Operating Systems
  • 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. Segmentation P1 data P2 code print function P2 data P1 code OS Code OS data OS stack logical address space
  • 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. Addressing Segments limit base S o logical address segment table yes Physical Address o < limit + no error
  • 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. 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. Protection and Sharing limit base 200 0 1000 200 1200 1 3500 9000 2000 LDT limit base 2300 0 500 2500 2500 1 9000 20000 3000 GDT 9000 limit base 0 1000 200 1 300 2000 12500 LDT
  • 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. 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. 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. virtual address from user descriptor offset limit base + segment table linear address directory page offset page frame PT directory page table directory base