SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating SystemRaj Mohan
 
Csc4320 chapter 8 2
Csc4320 chapter 8 2Csc4320 chapter 8 2
Csc4320 chapter 8 2bshikhar13
 
Mca ii os u-4 memory management
Mca  ii  os u-4 memory managementMca  ii  os u-4 memory management
Mca ii os u-4 memory managementRai University
 
Computer memory management
Computer memory managementComputer memory management
Computer memory managementKumar
 
Paging,Segmentation & Segment with Paging
Paging,Segmentation & Segment with PagingPaging,Segmentation & Segment with Paging
Paging,Segmentation & Segment with PagingMeghaj Mallick
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management Maitree Patel
 
Memory management
Memory managementMemory management
Memory managementcpjcollege
 
Combined paging and segmentation
Combined paging and segmentationCombined paging and segmentation
Combined paging and segmentationTech_MX
 
34 single partition allocation
34 single partition allocation34 single partition allocation
34 single partition allocationmyrajendra
 
Operating system paging and segmentation
Operating system paging and segmentationOperating system paging and segmentation
Operating system paging and segmentationhamza haseeb
 
Operation System
Operation SystemOperation System
Operation SystemANANTHI1997
 
Memory management
Memory managementMemory management
Memory managementImran Khan
 

Tendances (20)

Memory+management
Memory+managementMemory+management
Memory+management
 
Memory management
Memory managementMemory management
Memory management
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating System
 
Csc4320 chapter 8 2
Csc4320 chapter 8 2Csc4320 chapter 8 2
Csc4320 chapter 8 2
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Mca ii os u-4 memory management
Mca  ii  os u-4 memory managementMca  ii  os u-4 memory management
Mca ii os u-4 memory management
 
Memory management
Memory managementMemory management
Memory management
 
Computer memory management
Computer memory managementComputer memory management
Computer memory management
 
Paging,Segmentation & Segment with Paging
Paging,Segmentation & Segment with PagingPaging,Segmentation & Segment with Paging
Paging,Segmentation & Segment with Paging
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management
 
Memory management
Memory managementMemory management
Memory management
 
Combined paging and segmentation
Combined paging and segmentationCombined paging and segmentation
Combined paging and segmentation
 
34 single partition allocation
34 single partition allocation34 single partition allocation
34 single partition allocation
 
Operating system paging and segmentation
Operating system paging and segmentationOperating system paging and segmentation
Operating system paging and segmentation
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Memory management
Memory managementMemory management
Memory management
 
OS_Ch9
OS_Ch9OS_Ch9
OS_Ch9
 
Operation System
Operation SystemOperation System
Operation System
 
Memory management
Memory managementMemory management
Memory management
 
Memory management
Memory managementMemory management
Memory management
 

Similaire à Segmentation geekssay.com

Similaire à Segmentation geekssay.com (20)

Segmentation
SegmentationSegmentation
Segmentation
 
PAGIN AND SEGMENTATION.docx
PAGIN AND SEGMENTATION.docxPAGIN AND SEGMENTATION.docx
PAGIN AND SEGMENTATION.docx
 
Os4
Os4Os4
Os4
 
Os4
Os4Os4
Os4
 
os presentation.ppt
os presentation.pptos presentation.ppt
os presentation.ppt
 
Segmentation
SegmentationSegmentation
Segmentation
 
Memory Management Strategies - III.pdf
Memory Management Strategies - III.pdfMemory Management Strategies - III.pdf
Memory Management Strategies - III.pdf
 
10 instruction sets characteristics
10 instruction sets characteristics10 instruction sets characteristics
10 instruction sets characteristics
 
Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptx
 
Ch8 main memory
Ch8   main memoryCh8   main memory
Ch8 main memory
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
Anshika 1111.pptx
Anshika 1111.pptxAnshika 1111.pptx
Anshika 1111.pptx
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
Main Memory
Main MemoryMain Memory
Main Memory
 
Memory Management.pdf
Memory Management.pdfMemory Management.pdf
Memory Management.pdf
 
Deep Dive into DynamoDB
Deep Dive into DynamoDBDeep Dive into DynamoDB
Deep Dive into DynamoDB
 
10 instruction sets characteristics
10 instruction sets characteristics10 instruction sets characteristics
10 instruction sets characteristics
 
Unit-4 swapping.pptx
Unit-4 swapping.pptxUnit-4 swapping.pptx
Unit-4 swapping.pptx
 
Segmentation in operating systems
Segmentation in operating systemsSegmentation in operating systems
Segmentation in operating systems
 

Plus de Hemant Gautam

Make a fool geekssay.com sharing
Make a fool geekssay.com sharingMake a fool geekssay.com sharing
Make a fool geekssay.com sharingHemant Gautam
 
1 men die-younger geekssay.com sharing
1 men die-younger geekssay.com sharing1 men die-younger geekssay.com sharing
1 men die-younger geekssay.com sharingHemant Gautam
 
Shopping cart project geekssay.com
Shopping cart project geekssay.comShopping cart project geekssay.com
Shopping cart project geekssay.comHemant Gautam
 
Atm traffic management geekssay.com
Atm traffic management  geekssay.comAtm traffic management  geekssay.com
Atm traffic management geekssay.comHemant Gautam
 
Disk scheduling geekssay.com
Disk scheduling geekssay.comDisk scheduling geekssay.com
Disk scheduling geekssay.comHemant Gautam
 
Kruskals prims shared by: geekssay.com
Kruskals prims shared by: geekssay.comKruskals prims shared by: geekssay.com
Kruskals prims shared by: geekssay.comHemant Gautam
 
Knapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.comKnapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.comHemant Gautam
 
College Monitoring system BY: Geekssay.com
College Monitoring system BY: Geekssay.comCollege Monitoring system BY: Geekssay.com
College Monitoring system BY: Geekssay.comHemant Gautam
 

Plus de Hemant Gautam (8)

Make a fool geekssay.com sharing
Make a fool geekssay.com sharingMake a fool geekssay.com sharing
Make a fool geekssay.com sharing
 
1 men die-younger geekssay.com sharing
1 men die-younger geekssay.com sharing1 men die-younger geekssay.com sharing
1 men die-younger geekssay.com sharing
 
Shopping cart project geekssay.com
Shopping cart project geekssay.comShopping cart project geekssay.com
Shopping cart project geekssay.com
 
Atm traffic management geekssay.com
Atm traffic management  geekssay.comAtm traffic management  geekssay.com
Atm traffic management geekssay.com
 
Disk scheduling geekssay.com
Disk scheduling geekssay.comDisk scheduling geekssay.com
Disk scheduling geekssay.com
 
Kruskals prims shared by: geekssay.com
Kruskals prims shared by: geekssay.comKruskals prims shared by: geekssay.com
Kruskals prims shared by: geekssay.com
 
Knapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.comKnapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.com
 
College Monitoring system BY: Geekssay.com
College Monitoring system BY: Geekssay.comCollege Monitoring system BY: Geekssay.com
College Monitoring system BY: Geekssay.com
 

Dernier

5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...CaraSkikne1
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxheathfieldcps1
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice documentXsasf Sfdfasd
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxEduSkills OECD
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxAditiChauhan701637
 
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxPractical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxKatherine Villaluna
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxraviapr7
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxSaurabhParmar42
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsEugene Lysak
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapitolTechU
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesMohammad Hassany
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptxSandy Millin
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational PhilosophyShuvankar Madhu
 
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptxClinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptxraviapr7
 
How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17Celine George
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17Celine George
 
UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE
 

Dernier (20)

5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptx
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice document
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptx
 
Prelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quizPrelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quiz
 
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxPractical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptx
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptx
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George Wells
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptx
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming Classes
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
 
Finals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quizFinals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quiz
 
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdfPersonal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational Philosophy
 
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptxClinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
 
How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17
 
UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024
 

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