SlideShare a Scribd company logo
1 of 24
Paging and Segmentation
Logical vs. Physical Address Space
• Logical address – generated by the CPU; also referred to as
• Physical address – address seen by the memory unit
• Logical and physical addresses are the same in compile-time
and load-time; logical (virtual) and physical addresses differ in
execution-time.
• The user program deals with logical addresses; it never sees
the real physical addresses.
Paging
• Memory-management technique that permits the physical
address space of a process to be non-contiguous.
• Each process is divided into a number of small, fixed-size
partitions called pages or Divide logical memory into blocks of
same size called pages.
• Physical memory is divided into a large number of small, fixed-
size partitions called frames.
• When a process is to be executed, its pages are loaded into any
available memory frames.
• Some internal fragmentation , but no external fragmentation.
Address Translation Scheme
• Operating system maintains a
page table for each process
– Contains the frame number for
each process page
– To translate logical to physical
addresses
• A logical address is divided into:
– Page number (p) – used as an
index into a page table which
contains base address of each
page in physical memory.
– Page offset (d) – combined with
base address to define the
physical memory address that is
sent to the memory.
Paging Example
Page Table Implementation
• Implemented as a set of registers.(if Page table is less).
– Problem: If page table is large, it is not applicable.
• Page table kept in main memory. PTBR register points to the
Page table. Page-table length register (PRLR) indicates size of
the page table.
– Problem: In this scheme every data/instruction access
requires two memory accesses. One for the page table and
one for the data/instruction.
• Using Translation look aside buffer or associative registers.
– Very fast, very expensive.
Shared Pages
– Shared code
– One copy of read-only (reentrant) code shared among processes
(i.e., text editors, compilers, window systems).
– Shared code must appear in same location in the logical address
Space of all processes
• Private code and data
– Each process keeps a separate
copy of the code and data
– The pages for the private code
and data can appear anywhere
in the logical address space
Two-Level Page Table
• A logical address (on 32-bit machine with 4K page size) is
divided into:
– a page offset consisting of 12 bits.
– a page number consisting of 20 bits; further divided into:
• a 10-bit level-2 page number.
• a 10-bit level-1 page number.
• Thus, a logical address look likes
– p1 is an index into the outer page table
– p2 is the displacement within the page of the outer page
table
• Address translation scheme
Advantages
• Easy to allocate memory — keep a list of available frames, and
simple grab first one that’s free.
• Easy to swap — pages, frames, and often disk blocks as well,
all are same size.
• No external fragmentation
• Any page can be placed in any frame in physical memory
• Sharing of the common code is possible.
Disadvantages
• Internal fragmentation: Page size may not match size needed
by process
– Wasted memory grows with larger pages
• Page tables are fairly large , so page tables are too big to fit in
registers, so they must live in physical Memory.
• This table lookup adds an extra memory reference for every
address translation.
Segmentation
• A segment can be defined as a logical grouping of instructions,
such as a subroutine, array, or a data area.
• A program is a collection of segments.
• Segmentation is t technique for managing these segments.
• Divide a process into unequal size blocks called segments.
• Each segment has a name and a length.
• Memory Management Scheme that supports user view of
memory.
• A segment is a logical unit such as
– main program, procedure, function
– local variables, global variables, commonblock
– stack, symbol table, arrays
• Protect each entity independently
• Allow each segment to grow independently
• Share each segment independently
• Each of these segments are of variable
length and length will be defined in the
program.
Segmentation Architecture
• Segment Table
– Maps two-dimensional user-defined addresses into one-
dimensional physical addresses. Each table entry has
• Base - contains the starting physical address where
thesegments reside in memory.
• Limit - specifies the length of the segment.
• A logical address consistsof two parts.
– A segment number, s, and an offset, d.
• Segment number used as index into the segment table.
• The offset d is between 0 and the segment limit.
• The offset is added to the base to produce the physical
address.
• If the offset is not within the limit, trap to the operating
system.(logical address beyond end of segment).
• Segmentation Example:
Sharing of Segments
• Segments are shared when entries in the segment tables of
two different processes point to the same physical locations.
• It is possible to share only the parts of the programs.
• Subroutine packages are shared
among many users.
Advantages and Disadvantages
• Advantages:
– Each segment can be
• located independently
• separately protected
• grow independently
– Segments can be shared between processes.
– Eliminate the fragmentation.
• Disadvantages:
– Allocation algorithms as for memory partitions
– External fragmentation, back to compaction problem.
• Solution: combine segmentation and paging.
Segmentation vs. Paging
• Segment is good logical unit of information
– sharing, protection
• Segmentation
– Break process up into logical segments
• Segmentsare generally of different sizes
• Page is good physical unit of information
– simple memory management
• Paging
– Break process up into physical pages
– Pages are the same size
Paging Segmentation
The main memory partitioned into frames
or blocks.
The main memory partitioned into
segments.
The logical address space divided into
pages by compiler or MMU
The logical address space divided into
segment specified by the programmer.
Suffers from internal fragmentation or
page break
Suffers from external fragmentation.
Operating system maintains the page
table.
Operating system maintains the segment
table.
Does not supports the user view of
memory
Supports the user view of memory
Processor uses the page number and
displacement to calculate absolute
address.
Processor uses the segment number and
displacement to calculate absolute
address.
Multilevelpagingis possible Multilevel segmentation is possible. But
no use.
THANK YOU
PAGIN AND SEGMENTATION.docx
PAGIN AND SEGMENTATION.docx
PAGIN AND SEGMENTATION.docx
PAGIN AND SEGMENTATION.docx
PAGIN AND SEGMENTATION.docx

More Related Content

Similar to PAGIN AND SEGMENTATION.docx

Similar to PAGIN AND SEGMENTATION.docx (20)

UNIT-2 OS.pptx
UNIT-2 OS.pptxUNIT-2 OS.pptx
UNIT-2 OS.pptx
 
Main Memory
Main MemoryMain Memory
Main Memory
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Bab 4
Bab 4Bab 4
Bab 4
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
 
07-MemoryManagement.ppt
07-MemoryManagement.ppt07-MemoryManagement.ppt
07-MemoryManagement.ppt
 
OS UNIT4.pptx
OS UNIT4.pptxOS UNIT4.pptx
OS UNIT4.pptx
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
Memory management1
Memory management1Memory management1
Memory management1
 
os ppt.pptx
os  ppt.pptxos  ppt.pptx
os ppt.pptx
 
16. PagingImplementIssused.pptx
16. PagingImplementIssused.pptx16. PagingImplementIssused.pptx
16. PagingImplementIssused.pptx
 
Memory management
Memory managementMemory management
Memory management
 
Presentation on Segmentation
Presentation on SegmentationPresentation on Segmentation
Presentation on Segmentation
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
 
Memory Management in Operating Systems for all
Memory Management in Operating Systems for allMemory Management in Operating Systems for all
Memory Management in Operating Systems for all
 
Unit-4 swapping.pptx
Unit-4 swapping.pptxUnit-4 swapping.pptx
Unit-4 swapping.pptx
 
Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptx
 
OSCh9
OSCh9OSCh9
OSCh9
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OS
 
OS_Ch9
OS_Ch9OS_Ch9
OS_Ch9
 

Recently uploaded

Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 

PAGIN AND SEGMENTATION.docx

  • 2. Logical vs. Physical Address Space • Logical address – generated by the CPU; also referred to as • Physical address – address seen by the memory unit • Logical and physical addresses are the same in compile-time and load-time; logical (virtual) and physical addresses differ in execution-time. • The user program deals with logical addresses; it never sees the real physical addresses.
  • 3. Paging • Memory-management technique that permits the physical address space of a process to be non-contiguous. • Each process is divided into a number of small, fixed-size partitions called pages or Divide logical memory into blocks of same size called pages. • Physical memory is divided into a large number of small, fixed- size partitions called frames. • When a process is to be executed, its pages are loaded into any available memory frames. • Some internal fragmentation , but no external fragmentation.
  • 4. Address Translation Scheme • Operating system maintains a page table for each process – Contains the frame number for each process page – To translate logical to physical addresses • A logical address is divided into: – Page number (p) – used as an index into a page table which contains base address of each page in physical memory. – Page offset (d) – combined with base address to define the physical memory address that is sent to the memory.
  • 6. Page Table Implementation • Implemented as a set of registers.(if Page table is less). – Problem: If page table is large, it is not applicable. • Page table kept in main memory. PTBR register points to the Page table. Page-table length register (PRLR) indicates size of the page table. – Problem: In this scheme every data/instruction access requires two memory accesses. One for the page table and one for the data/instruction. • Using Translation look aside buffer or associative registers. – Very fast, very expensive.
  • 7. Shared Pages – Shared code – One copy of read-only (reentrant) code shared among processes (i.e., text editors, compilers, window systems). – Shared code must appear in same location in the logical address Space of all processes • Private code and data – Each process keeps a separate copy of the code and data – The pages for the private code and data can appear anywhere in the logical address space
  • 8. Two-Level Page Table • A logical address (on 32-bit machine with 4K page size) is divided into: – a page offset consisting of 12 bits. – a page number consisting of 20 bits; further divided into: • a 10-bit level-2 page number. • a 10-bit level-1 page number. • Thus, a logical address look likes – p1 is an index into the outer page table – p2 is the displacement within the page of the outer page table • Address translation scheme
  • 9. Advantages • Easy to allocate memory — keep a list of available frames, and simple grab first one that’s free. • Easy to swap — pages, frames, and often disk blocks as well, all are same size. • No external fragmentation • Any page can be placed in any frame in physical memory • Sharing of the common code is possible.
  • 10. Disadvantages • Internal fragmentation: Page size may not match size needed by process – Wasted memory grows with larger pages • Page tables are fairly large , so page tables are too big to fit in registers, so they must live in physical Memory. • This table lookup adds an extra memory reference for every address translation.
  • 11. Segmentation • A segment can be defined as a logical grouping of instructions, such as a subroutine, array, or a data area. • A program is a collection of segments. • Segmentation is t technique for managing these segments. • Divide a process into unequal size blocks called segments. • Each segment has a name and a length. • Memory Management Scheme that supports user view of memory.
  • 12. • A segment is a logical unit such as – main program, procedure, function – local variables, global variables, commonblock – stack, symbol table, arrays • Protect each entity independently • Allow each segment to grow independently • Share each segment independently • Each of these segments are of variable length and length will be defined in the program.
  • 13. Segmentation Architecture • Segment Table – Maps two-dimensional user-defined addresses into one- dimensional physical addresses. Each table entry has • Base - contains the starting physical address where thesegments reside in memory. • Limit - specifies the length of the segment. • A logical address consistsof two parts. – A segment number, s, and an offset, d. • Segment number used as index into the segment table. • The offset d is between 0 and the segment limit. • The offset is added to the base to produce the physical address.
  • 14. • If the offset is not within the limit, trap to the operating system.(logical address beyond end of segment). • Segmentation Example:
  • 15. Sharing of Segments • Segments are shared when entries in the segment tables of two different processes point to the same physical locations. • It is possible to share only the parts of the programs. • Subroutine packages are shared among many users.
  • 16. Advantages and Disadvantages • Advantages: – Each segment can be • located independently • separately protected • grow independently – Segments can be shared between processes. – Eliminate the fragmentation. • Disadvantages: – Allocation algorithms as for memory partitions – External fragmentation, back to compaction problem. • Solution: combine segmentation and paging.
  • 17. Segmentation vs. Paging • Segment is good logical unit of information – sharing, protection • Segmentation – Break process up into logical segments • Segmentsare generally of different sizes • Page is good physical unit of information – simple memory management • Paging – Break process up into physical pages – Pages are the same size
  • 18. Paging Segmentation The main memory partitioned into frames or blocks. The main memory partitioned into segments. The logical address space divided into pages by compiler or MMU The logical address space divided into segment specified by the programmer. Suffers from internal fragmentation or page break Suffers from external fragmentation. Operating system maintains the page table. Operating system maintains the segment table. Does not supports the user view of memory Supports the user view of memory Processor uses the page number and displacement to calculate absolute address. Processor uses the segment number and displacement to calculate absolute address. Multilevelpagingis possible Multilevel segmentation is possible. But no use.