SlideShare a Scribd company logo
1 of 33
COMBINED PAGING AND
   SEGMENTATION
CONTENTS

 A small review of Paging
 Segmentation
 Combined Segmentation and
  Paging
 Examples
PAGING
                  allows the physical
                  address space of a
 Extends to any      process to be
     levels         non-contiguous
                                               Pages



PTBR and PTLR       PAGING
                                            Page Frames


CPU generated
Logical Address                           PageTable
                   FrameTable
                   (One of the          (One for each
Page# Offset                               Process)
                  Main Memory)
PAGING HARDWARE
EXAMPLE-LOGICAL TO PHYSICAL ADDRESS
           TRANSLATION IN PAGING
                16-bit logical address

6-bit page #                    10-bit offset #

0   0   0   0   0   1   0   1    1   1       0       1       1   1   0



                                Page Table

                        0   0   0    0   1       0       1
                        1   0   0    0   1       1       0


                                         0 0 0 1 1 0 0 1 1 1 0 1 1 1 1 0


                                                                     16-bit Physical address
ADVANTAGES                   DISADVANTAGES


• No external Fragmentation   • Internal fragmentation
• Simple memory               • Page tables may consume
  management algorithm          more memory.
• Swapping is easy (Equal     • Multi level paging leads to
  sized Pages and Page          memory reference overhead.
  Frames)
HOW DOES USER VIEW MEMORY??

• An important part of the memory management is that become
  unavoidable with paging is the separation of the user’s view of
  the memory and the actual physical memory
• The users view is mapped to the physical memory
• Thus the differentiation comes between the logical and
  physical memory.
                                      Do users view memory as linear
                                      array of bytes some containing
                                      instruction and other
                                      containing data???


     No…Rather they would see it as
      collection of segments…….
SEGMENTATION
It is a memory-management scheme that supports
user view of memory.

A program is a collection of segments which is a
logical unit which may be of unequal size.
• Each segment may be code of a single procedure, the data of an array, or the
  collection of all local data values used by a particular module.

Here main memory is not partitioned.

When user program is compiled , compiler
automatically constructs segments.
• The program segments are specified by programmer to the
  compiler (Decision made by the programmer)
SO HOW IS IT FOR C COMPILER???


                       Code

                 Global Variables

                       Heap
  C COMPILER
               The standard C library

                       Stack
LOGICAL ADDRESSING IN SEGMENTATION

                                                        Segment number
                      Logical Address space
                                                              Offset

  The mapping of the logical address to the physical address is done with the help of
  the segment table.
the length of the segment
                                    SEGMENT TABLE

                Segment Limit        Segment Base        Other bits




                                       A bit is needed to determine if the segment is already
   starting address of the             in main memory (P)
   corresponding                       Another bit is needed to determine if the segment has
   segment in main mem                 been modified since it was loaded in main memory (M)
• The segments of a program can be placed anywhere in the
  main memory.
• For each process in each execution, there is one segment
  address table.
• Segment-table base register (STBR) points to the segment
  table’s location in memory
• Segment-table length register (STLR) indicates number of
  segments used by a program
EXAMPLE OF SEGMENTATION
EXAMPLE-LOGICAL TO PHYSICAL ADDRESS
        TRANSLATION IN SEGMENTATION
                16-bit logical address

                                  12-bit offset #

0   0   0   1   0   0     0   1    1   1   0   1    1   1     0



                          Segment Table
             Length                            Base
    0 0 0 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
    1 0 1 1 1 1 0 0 1 1 1 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0

        12-bit offset #                        16-bit seg base

                                           0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0

                                                            16-bit Physical address
SEGMENTATION HARDWARE
Logical address                 External
                               Segment #      Offset            fragmentation
   Seg 1
   (code)      Seg 2                                                       Physical
               (data)                                                      memory
    Seg 3
                                                  as in paging:
   (stack)
                                                 valid, modified,           Seg 3
   Logical Memory                                protection, etc.          (stack)

        MMU                                    Segment table               Seg 1
                                             Base Limit Other              (code)
                 offset <
         no       limit ?       STBR
                        yes     STLR
 memory                                                                    Seg 2
access fault                                                               (data)
                              Segment Base + Offset
                                 physical address
                                                                    0x00
ADVANTAGES OF SEGMENTATION

• No internal fragmentation
• Segment tables consume less memory than page tables ( only
  one entry per actual segment as opposed to one entry per page
  in Paging method)
• Because of the small segment table, memory reference is easy.
• Lends itself to sharing data among processes.
• Lends itself to protection.
• As the individual lines of a page do not form one logical
  unit, it is not possible to set a particular access right to a page.
• Note that each segment could be set up an access right
PROTECTION AND SHARING

• Segmentation lends itself to the implementation of protection
  and sharing policies
• Each entry has a base address and length so inadvertent
  memory access can be controlled
• Sharing can be achieved by segments referencing multiple
  processes
• Two processes that need to share access to a single segment
  would have the same segment name and address in their
  segment tables.
DISADVANTAGES
• External fragmentation.
• Costly memory management algorithm
• Unequal size of segments is not good in the case of swapping.



     So, why can’t we combine the ease of sharing and
     protection we get from segments with efficient
     memory utilization we get from pages ????
COMBINED SEGMENTATION AND
            PAGING

         In a combined
paging/segmentation system a     Segmentation is visible to the
user’s address space is broken          programmer
up into a number of segments.
  Each segment is broken up
 into a number of fixed-sized
   pages which are equal in      Paging is transparent to the
   length to a main memory              programmer
              frame
COMBINING SEGMENTS AND PAGING
IMPLEMENTING SEGMENTATION
  • Each process has:
               one segment table.
               several page tables : one page table per segment.

                            Segment number : used to index the
                            segment table who’s entry gives the starting
                            address of the page table for that segment.

  Logical                   Page number : used to index that page table
Address space                to obtain the corresponding frame number


                             Offset : used to locate the word within the
                                                frame.
ADDRESSES IN A SEGMENTED PAGING
             SYSTEM
 The segment number indexes into the segment table which
  yields the base address of the page table for that segment.
 Check the remainder of the address (page number and offset)
  against the limit of the segment.
 Use the page number to index the page table. The entry is the
  frame. (The rest of this is just like paging.)
 Concat the frame and the offset to get the physical address.
ADDRESS TRANSLATION
                      Seg      Page
                      ment     table
                      limit    base



                               yes                                 Physical
CPU
         s       so        <                    so                 memory

       Logical        no
       address                             p         po

                      Memory         +
                      trap
                                         Page table (for
                                         segment)

                                                          f   po
                                            f
ADVANTAGES
• Reduces memory usage as opposed to pure paging
    – Page table size limited by segment size
    – Segment table has only one entry per actual segment
• Share individual pages by copying page table entries.
• Share whole segments by sharing segment table entries, which
   is the same as sharing the page table for that segment.
• Most advantages of paging still hold
    – Simplifies memory allocation
    – Eliminates external fragmentation.
 • In general this system combines the efficiency in paging with
    the protection and sharing capabilities of the segmentation.
DISADVANTAGE

• Internal fragmentation still exists…

          Page 1   Process requests a 6KB address range
          Page 2   (4KB pages)




                            internal
                         fragmentation
EXAMPLE

           The Intel Pentium
Supports both segmentation and segmentation
with paging. CPU generates logical address given
to segmentation unit which in turn is handed over
to paging unit which generates physical address
in main memory
EXAMPLE 1
• Assume that a task is divided into four equal-sized segments
  and that the system builds an eight-entry page descriptor table
  for each segment. Thus, the system has a combination of
  segmentation and paging. Assume also that the page size is 2
  Kbytes.
   a. What is the maximum size of each segment?
   b What is the maximum logical address space for the task?
   c. Assume that an element in physical location 00021ABC is
  accessed by this task. What is the format of the logical address
  that the task generates for it? What is the maximum physical
  address space for the system?
SOLUTION

A. (8 entries in the page table) x 2K = 16K.

B. (16 K) x 4 segments per task = 64K.

C. The physical address is 32 bits wide total, so the frame
   number must be 21 bits wide. Thus 00021ABC is represented
   in binary as:
             Frame                  Offset
    0000 0000 0000 0010 0001 1 | 010 1011 1100

D. The maximum physical address space is 232 = 4 GB
EXAMPLE-2
• This question refers to an architecture using segmentation with
  paging. In this architecture, the 32-bit virtual address is divided into
  fields as follows:
              4 bit segment number
              12 bit page number
               16 bit offset

   Find the physical address corresponding to each of the following
   virtual addresses (answer "bad virtual address" if the virtual address
   is invalid)..

1. 00000000
2. 20022002
3. 10015555
Segment table         Page table A       Page table B
0    Page table A     0      CAFE        0       F000


1    Page table B     1      DEAD        1      D8BF


x    (rest invalid)   2      BEEF        X   (rest invalid)


                      3      BA11


                      X
SOLUTION:

1. CAFE0000.
2. Bad virtual address.
3. D8BF5555.
REFERENCES….



• Silberschatz,Galvin,Gange – Operating
  System Concepts (7th Ed)
•William Stalling – Operating System
(6th Ed)
Combined paging and segmentation

More Related Content

What's hot

Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating SystemRaj Mohan
 
Multiprocessor
MultiprocessorMultiprocessor
MultiprocessorNeel Patel
 
Free Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFSFree Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFSUnited International University
 
Internal representation of files ppt
Internal representation of files pptInternal representation of files ppt
Internal representation of files pptAbhaysinh Surve
 
Lecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptxLecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptxImranBhatti58
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1Shashwat Shriparv
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output OrganizationKamal Acharya
 
Master method theorem
Master method theoremMaster method theorem
Master method theoremRajendran
 
Code Optimization
Code OptimizationCode Optimization
Code Optimizationguest9f8315
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentationRanjeet Kumar
 
Segmentation in Operating Systems.
Segmentation in Operating Systems.Segmentation in Operating Systems.
Segmentation in Operating Systems.Muhammad SiRaj Munir
 
Computer organization memory
Computer organization memoryComputer organization memory
Computer organization memoryDeepak John
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipeliningMazin Alwaaly
 
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURESOPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURESpriyasoundar
 

What's hot (20)

Disk structure
Disk structureDisk structure
Disk structure
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating System
 
Multiprocessor
MultiprocessorMultiprocessor
Multiprocessor
 
Free Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFSFree Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFS
 
DMA operation
DMA operationDMA operation
DMA operation
 
Internal representation of files ppt
Internal representation of files pptInternal representation of files ppt
Internal representation of files ppt
 
Lecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptxLecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptx
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output Organization
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentation
 
Segmentation in Operating Systems.
Segmentation in Operating Systems.Segmentation in Operating Systems.
Segmentation in Operating Systems.
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Computer organization memory
Computer organization memoryComputer organization memory
Computer organization memory
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipelining
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURESOPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
 

Similar to Combined paging and segmentation

Segmentation geekssay.com
Segmentation  geekssay.comSegmentation  geekssay.com
Segmentation geekssay.comHemant Gautam
 
37 segmentation
37 segmentation37 segmentation
37 segmentationmyrajendra
 
CSI-503 - 8.Paging and Segmentation
CSI-503 - 8.Paging and SegmentationCSI-503 - 8.Paging and Segmentation
CSI-503 - 8.Paging and Segmentationghayour abbas
 
ppt on Segmentation in operationg system
ppt on Segmentation in operationg systemppt on Segmentation in operationg system
ppt on Segmentation in operationg systemsuraj sharma
 
Paging and Segmentation
Paging and SegmentationPaging and Segmentation
Paging and SegmentationMadhur Gupta
 
Introduction to Memoria
Introduction to MemoriaIntroduction to Memoria
Introduction to MemoriaVictor Smirnov
 
Unix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsDrishti Bhalla
 
Memory Management Strategies - III.pdf
Memory Management Strategies - III.pdfMemory Management Strategies - III.pdf
Memory Management Strategies - III.pdfHarika Pudugosula
 
Process' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/LinuxProcess' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/LinuxVarun Mahajan
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 

Similar to Combined paging and segmentation (20)

Segmentation geekssay.com
Segmentation  geekssay.comSegmentation  geekssay.com
Segmentation geekssay.com
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Segmentation
SegmentationSegmentation
Segmentation
 
37 segmentation
37 segmentation37 segmentation
37 segmentation
 
Os4
Os4Os4
Os4
 
Os4
Os4Os4
Os4
 
CSI-503 - 8.Paging and Segmentation
CSI-503 - 8.Paging and SegmentationCSI-503 - 8.Paging and Segmentation
CSI-503 - 8.Paging and Segmentation
 
ppt on Segmentation in operationg system
ppt on Segmentation in operationg systemppt on Segmentation in operationg system
ppt on Segmentation in operationg system
 
os presentation.ppt
os presentation.pptos presentation.ppt
os presentation.ppt
 
VIRTUAL MEMORY
VIRTUAL MEMORYVIRTUAL MEMORY
VIRTUAL MEMORY
 
Paging and Segmentation
Paging and SegmentationPaging and Segmentation
Paging and Segmentation
 
Memory management
Memory managementMemory management
Memory management
 
Introduction to Memoria
Introduction to MemoriaIntroduction to Memoria
Introduction to Memoria
 
Unix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating Systems
 
Memory Management Strategies - III.pdf
Memory Management Strategies - III.pdfMemory Management Strategies - III.pdf
Memory Management Strategies - III.pdf
 
Cache memory
Cache memoryCache memory
Cache memory
 
Process' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/LinuxProcess' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/Linux
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Memory management
Memory managementMemory management
Memory management
 
It322 intro 1
It322 intro 1It322 intro 1
It322 intro 1
 

More from Tech_MX

Virtual base class
Virtual base classVirtual base class
Virtual base classTech_MX
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimationTech_MX
 
Templates in C++
Templates in C++Templates in C++
Templates in C++Tech_MX
 
String & its application
String & its applicationString & its application
String & its applicationTech_MX
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2Tech_MX
 
Stack data structure
Stack data structureStack data structure
Stack data structureTech_MX
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application Tech_MX
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applicationsTech_MX
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2Tech_MX
 
Set data structure
Set data structure Set data structure
Set data structure Tech_MX
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating SystemTech_MX
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Tech_MX
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pcTech_MX
 
More on Lex
More on LexMore on Lex
More on LexTech_MX
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbmsTech_MX
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)Tech_MX
 
Memory dbms
Memory dbmsMemory dbms
Memory dbmsTech_MX
 

More from Tech_MX (20)

Virtual base class
Virtual base classVirtual base class
Virtual base class
 
Uid
UidUid
Uid
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimation
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
 
String & its application
String & its applicationString & its application
String & its application
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
 
Spss
SpssSpss
Spss
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2
 
Set data structure
Set data structure Set data structure
Set data structure
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
 
Parsing
ParsingParsing
Parsing
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pc
 
More on Lex
More on LexMore on Lex
More on Lex
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbms
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)
 
Memory dbms
Memory dbmsMemory dbms
Memory dbms
 

Recently uploaded

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Recently uploaded (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Combined paging and segmentation

  • 1. COMBINED PAGING AND SEGMENTATION
  • 2. CONTENTS  A small review of Paging  Segmentation  Combined Segmentation and Paging  Examples
  • 3. PAGING allows the physical address space of a Extends to any process to be levels non-contiguous Pages PTBR and PTLR PAGING Page Frames CPU generated Logical Address PageTable FrameTable (One of the (One for each Page# Offset Process) Main Memory)
  • 5. EXAMPLE-LOGICAL TO PHYSICAL ADDRESS TRANSLATION IN PAGING 16-bit logical address 6-bit page # 10-bit offset # 0 0 0 0 0 1 0 1 1 1 0 1 1 1 0 Page Table 0 0 0 0 1 0 1 1 0 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 0 1 1 1 1 0 16-bit Physical address
  • 6. ADVANTAGES DISADVANTAGES • No external Fragmentation • Internal fragmentation • Simple memory • Page tables may consume management algorithm more memory. • Swapping is easy (Equal • Multi level paging leads to sized Pages and Page memory reference overhead. Frames)
  • 7. HOW DOES USER VIEW MEMORY?? • An important part of the memory management is that become unavoidable with paging is the separation of the user’s view of the memory and the actual physical memory • The users view is mapped to the physical memory • Thus the differentiation comes between the logical and physical memory. Do users view memory as linear array of bytes some containing instruction and other containing data??? No…Rather they would see it as collection of segments…….
  • 8. SEGMENTATION It is a memory-management scheme that supports user view of memory. A program is a collection of segments which is a logical unit which may be of unequal size. • Each segment may be code of a single procedure, the data of an array, or the collection of all local data values used by a particular module. Here main memory is not partitioned. When user program is compiled , compiler automatically constructs segments. • The program segments are specified by programmer to the compiler (Decision made by the programmer)
  • 9. SO HOW IS IT FOR C COMPILER??? Code Global Variables Heap C COMPILER The standard C library Stack
  • 10. LOGICAL ADDRESSING IN SEGMENTATION Segment number Logical Address space Offset The mapping of the logical address to the physical address is done with the help of the segment table. the length of the segment SEGMENT TABLE Segment Limit Segment Base Other bits A bit is needed to determine if the segment is already starting address of the in main memory (P) corresponding Another bit is needed to determine if the segment has segment in main mem been modified since it was loaded in main memory (M)
  • 11. • The segments of a program can be placed anywhere in the main memory. • For each process in each execution, there is one segment address table. • Segment-table base register (STBR) points to the segment table’s location in memory • Segment-table length register (STLR) indicates number of segments used by a program
  • 13. EXAMPLE-LOGICAL TO PHYSICAL ADDRESS TRANSLATION IN SEGMENTATION 16-bit logical address 12-bit offset # 0 0 0 1 0 0 0 1 1 1 0 1 1 1 0 Segment Table Length Base 0 0 0 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 12-bit offset # 16-bit seg base 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 16-bit Physical address
  • 15. Logical address External Segment # Offset fragmentation Seg 1 (code) Seg 2 Physical (data) memory Seg 3 as in paging: (stack) valid, modified, Seg 3 Logical Memory protection, etc. (stack) MMU Segment table Seg 1 Base Limit Other (code) offset < no limit ? STBR yes STLR memory Seg 2 access fault (data) Segment Base + Offset physical address 0x00
  • 16. ADVANTAGES OF SEGMENTATION • No internal fragmentation • Segment tables consume less memory than page tables ( only one entry per actual segment as opposed to one entry per page in Paging method) • Because of the small segment table, memory reference is easy. • Lends itself to sharing data among processes. • Lends itself to protection. • As the individual lines of a page do not form one logical unit, it is not possible to set a particular access right to a page. • Note that each segment could be set up an access right
  • 17. PROTECTION AND SHARING • Segmentation lends itself to the implementation of protection and sharing policies • Each entry has a base address and length so inadvertent memory access can be controlled • Sharing can be achieved by segments referencing multiple processes • Two processes that need to share access to a single segment would have the same segment name and address in their segment tables.
  • 18. DISADVANTAGES • External fragmentation. • Costly memory management algorithm • Unequal size of segments is not good in the case of swapping. So, why can’t we combine the ease of sharing and protection we get from segments with efficient memory utilization we get from pages ????
  • 19. COMBINED SEGMENTATION AND PAGING In a combined paging/segmentation system a Segmentation is visible to the user’s address space is broken programmer up into a number of segments. Each segment is broken up into a number of fixed-sized pages which are equal in Paging is transparent to the length to a main memory programmer frame
  • 21. IMPLEMENTING SEGMENTATION • Each process has: one segment table. several page tables : one page table per segment. Segment number : used to index the segment table who’s entry gives the starting address of the page table for that segment. Logical Page number : used to index that page table Address space to obtain the corresponding frame number Offset : used to locate the word within the frame.
  • 22. ADDRESSES IN A SEGMENTED PAGING SYSTEM  The segment number indexes into the segment table which yields the base address of the page table for that segment.  Check the remainder of the address (page number and offset) against the limit of the segment.  Use the page number to index the page table. The entry is the frame. (The rest of this is just like paging.)  Concat the frame and the offset to get the physical address.
  • 23. ADDRESS TRANSLATION Seg Page ment table limit base yes Physical CPU s so < so memory Logical no address p po Memory + trap Page table (for segment) f po f
  • 24. ADVANTAGES • Reduces memory usage as opposed to pure paging – Page table size limited by segment size – Segment table has only one entry per actual segment • Share individual pages by copying page table entries. • Share whole segments by sharing segment table entries, which is the same as sharing the page table for that segment. • Most advantages of paging still hold – Simplifies memory allocation – Eliminates external fragmentation. • In general this system combines the efficiency in paging with the protection and sharing capabilities of the segmentation.
  • 25. DISADVANTAGE • Internal fragmentation still exists… Page 1 Process requests a 6KB address range Page 2 (4KB pages) internal fragmentation
  • 26. EXAMPLE The Intel Pentium Supports both segmentation and segmentation with paging. CPU generates logical address given to segmentation unit which in turn is handed over to paging unit which generates physical address in main memory
  • 27. EXAMPLE 1 • Assume that a task is divided into four equal-sized segments and that the system builds an eight-entry page descriptor table for each segment. Thus, the system has a combination of segmentation and paging. Assume also that the page size is 2 Kbytes. a. What is the maximum size of each segment? b What is the maximum logical address space for the task? c. Assume that an element in physical location 00021ABC is accessed by this task. What is the format of the logical address that the task generates for it? What is the maximum physical address space for the system?
  • 28. SOLUTION A. (8 entries in the page table) x 2K = 16K. B. (16 K) x 4 segments per task = 64K. C. The physical address is 32 bits wide total, so the frame number must be 21 bits wide. Thus 00021ABC is represented in binary as: Frame Offset 0000 0000 0000 0010 0001 1 | 010 1011 1100 D. The maximum physical address space is 232 = 4 GB
  • 29. EXAMPLE-2 • This question refers to an architecture using segmentation with paging. In this architecture, the 32-bit virtual address is divided into fields as follows: 4 bit segment number 12 bit page number 16 bit offset Find the physical address corresponding to each of the following virtual addresses (answer "bad virtual address" if the virtual address is invalid).. 1. 00000000 2. 20022002 3. 10015555
  • 30. Segment table Page table A Page table B 0 Page table A 0 CAFE 0 F000 1 Page table B 1 DEAD 1 D8BF x (rest invalid) 2 BEEF X (rest invalid) 3 BA11 X
  • 31. SOLUTION: 1. CAFE0000. 2. Bad virtual address. 3. D8BF5555.
  • 32. REFERENCES…. • Silberschatz,Galvin,Gange – Operating System Concepts (7th Ed) •William Stalling – Operating System (6th Ed)

Editor's Notes

  1. Segmentation lends itself to the implementation of protection and sharing policies.Because each segment table entry includes a length as well as a base address, a programcannot inadvertently access a main memory location beyond the limits of asegment. To achieve sharing, it is possible for a segment to be referenced in the segmenttables of more than one process. The same mechanisms are, of course, availablein a paging system. However, in this case the page structure of programs anddata is not visible to the programmer, making the specification of protection andsharing requirements more awkward.