SlideShare ist ein Scribd-Unternehmen logo
1 von 12
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

Weitere ähnliche Inhalte

Was ist angesagt?

Computer memory management
Computer memory managementComputer memory management
Computer memory management
Kumar
 
Combined paging and segmentation
Combined paging and segmentationCombined paging and segmentation
Combined paging and segmentation
Tech_MX
 
34 single partition allocation
34 single partition allocation34 single partition allocation
34 single partition allocation
myrajendra
 

Was ist angesagt? (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
 

Ähnlich wie Segmentation geekssay.com

10 instruction sets characteristics
10 instruction sets characteristics10 instruction sets characteristics
10 instruction sets characteristics
Sher Shah Merkhel
 

Ähnlich wie 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
 

Mehr von 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
 

Kürzlich hochgeladen

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 

Kürzlich hochgeladen (20)

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 

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