SlideShare a Scribd company logo
Operating System 35
Paging
Prof Neeraj Bhargava
Vaibhav Khanna
Department of Computer Science
School of Engineering and Systems Sciences
Maharshi Dayanand Saraswati University Ajmer
Paging
• Physical address space of a process can be noncontiguous;
process is allocated physical memory whenever the latter is
available
– Avoids external fragmentation
– Avoids problem of varying sized memory chunks
• Divide physical memory into fixed-sized blocks called frames
– Size is power of 2, between 512 bytes and 16 Mbytes
• Divide logical memory into blocks of same size called pages
• Keep track of all free frames
• To run a program of size N pages, need to find N free frames and
load program
• Set up a page table to translate logical to physical addresses
• Backing store likewise split into pages
• Still have Internal fragmentation
Address Translation Scheme
• Address generated by CPU 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 unit
– For given logical address space 2m and page size 2n
page number page offset
p d
m -n n
Paging Hardware
Paging Model of Logical and Physical Memory
Paging Example
n=2 and m=4 32-byte memory and 4-byte pages
Paging (Cont.)
• Calculating internal fragmentation
– Page size = 2,048 bytes
– Process size = 72,766 bytes
– 35 pages + 1,086 bytes
– Internal fragmentation of 2,048 - 1,086 = 962 bytes
– Worst case fragmentation = 1 frame – 1 byte
– On average fragmentation = 1 / 2 frame size
– So small frame sizes desirable?
– But each page table entry takes memory to track
– Page sizes growing over time
• Solaris supports two page sizes – 8 KB and 4 MB
• Process view and physical memory now very different
• By implementation process can only access its own memory
Free Frames
Before allocation After allocation
Implementation of Page Table
• Page table is kept in main memory
• Page-table base register (PTBR) points to the
page table
• Page-table length register (PTLR) indicates size
of the page table
• In this scheme every data/instruction access
requires two memory accesses
– One for the page table and one for the data /
instruction
• The two memory access problem can be solved
by the use of a special fast-lookup hardware
cache called associative memory or translation
look-aside buffers (TLBs)
Implementation of Page Table (Cont.)
• Some TLBs store address-space identifiers
(ASIDs) in each TLB entry – uniquely identifies
each process to provide address-space
protection for that process
– Otherwise need to flush at every context switch
• TLBs typically small (64 to 1,024 entries)
• On a TLB miss, value is loaded into the TLB for
faster access next time
– Replacement policies must be considered
– Some entries can be wired down for permanent
fast access
Associative Memory
• Associative memory – parallel search
• Address translation (p, d)
– If p is in associative register, get frame # out
– Otherwise get frame # from page table in
memory
Page # Frame #
Paging Hardware With TLB
Effective Access Time
• Associative Lookup =  time unit
– Can be < 10% of memory access time
• Hit ratio = 
– Hit ratio – percentage of times that a page number is found in the
associative registers; ratio related to number of associative
registers
• Consider  = 80%,  = 20ns for TLB search, 100ns for memory
access
• Effective Access Time (EAT)
EAT = (1 + )  + (2 + )(1 – )
= 2 +  – 
• Consider  = 80%,  = 20ns for TLB search, 100ns for memory
access
– EAT = 0.80 x 100 + 0.20 x 200 = 120ns
• Consider more realistic hit ratio ->  = 99%,  = 20ns for TLB
search, 100ns for memory access
– EAT = 0.99 x 100 + 0.01 x 200 = 101ns
Memory Protection
• Memory protection implemented by associating
protection bit with each frame to indicate if read-only or
read-write access is allowed
– Can also add more bits to indicate page execute-only, and
so on
• Valid-invalid bit attached to each entry in the page
table:
– “valid” indicates that the associated page is in the
process’ logical address space, and is thus a legal page
– “invalid” indicates that the page is not in the process’
logical address space
– Or use page-table length register (PTLR)
• Any violations result in a trap to the kernel
Valid (v) or Invalid (i) Bit In A Page Table
Assignment
• Explain in detail the concept of paging

More Related Content

PPTX
Implementation of page table
PDF
Hardware implementation of page table
PPTX
Memory management
PPTX
Inverted page tables basic
PPT
Chapter 9 - Virtual Memory
PPTX
Virtual Memory in Windows
PPT
Virtual memory
PDF
Virtual Memory - Part1
Implementation of page table
Hardware implementation of page table
Memory management
Inverted page tables basic
Chapter 9 - Virtual Memory
Virtual Memory in Windows
Virtual memory
Virtual Memory - Part1

Similar to Operating system 35 paging (20)

PPTX
Unit-4 swapping.pptx
PPT
Memory management
PPT
Ch9 OS
 
PPT
PPTX
Kalpana Devi/Operating System/Paging.pptx
PPT
Memory+management
PPT
Chapter 8 - Main Memory
PPTX
Main Memory
PPT
PPT
Main memory os - prashant odhavani- 160920107003
PPTX
PPTX
Unit 5Memory management.pptx
DOCX
PAGIN AND SEGMENTATION.docx
PPT
unit-4 class (2).ppt,Memory managements part-1
PPTX
Memory Managment(OS).pptx
PPT
Memory organization including cache and RAM.ppt
Unit-4 swapping.pptx
Memory management
Ch9 OS
 
Kalpana Devi/Operating System/Paging.pptx
Memory+management
Chapter 8 - Main Memory
Main Memory
Main memory os - prashant odhavani- 160920107003
Unit 5Memory management.pptx
PAGIN AND SEGMENTATION.docx
unit-4 class (2).ppt,Memory managements part-1
Memory Managment(OS).pptx
Memory organization including cache and RAM.ppt
Ad

More from Vaibhav Khanna (20)

PPTX
Information and network security 47 authentication applications
PPTX
Information and network security 46 digital signature algorithm
PPTX
Information and network security 45 digital signature standard
PPTX
Information and network security 44 direct digital signatures
PPTX
Information and network security 43 digital signatures
PPTX
Information and network security 42 security of message authentication code
PPTX
Information and network security 41 message authentication code
PPTX
Information and network security 40 sha3 secure hash algorithm
PPTX
Information and network security 39 secure hash algorithm
PPTX
Information and network security 38 birthday attacks and security of hash fun...
PPTX
Information and network security 37 hash functions and message authentication
PPTX
Information and network security 35 the chinese remainder theorem
PPTX
Information and network security 34 primality
PPTX
Information and network security 33 rsa algorithm
PPTX
Information and network security 32 principles of public key cryptosystems
PPTX
Information and network security 31 public key cryptography
PPTX
Information and network security 30 random numbers
PPTX
Information and network security 29 international data encryption algorithm
PPTX
Information and network security 28 blowfish
PPTX
Information and network security 27 triple des
Information and network security 47 authentication applications
Information and network security 46 digital signature algorithm
Information and network security 45 digital signature standard
Information and network security 44 direct digital signatures
Information and network security 43 digital signatures
Information and network security 42 security of message authentication code
Information and network security 41 message authentication code
Information and network security 40 sha3 secure hash algorithm
Information and network security 39 secure hash algorithm
Information and network security 38 birthday attacks and security of hash fun...
Information and network security 37 hash functions and message authentication
Information and network security 35 the chinese remainder theorem
Information and network security 34 primality
Information and network security 33 rsa algorithm
Information and network security 32 principles of public key cryptosystems
Information and network security 31 public key cryptography
Information and network security 30 random numbers
Information and network security 29 international data encryption algorithm
Information and network security 28 blowfish
Information and network security 27 triple des
Ad

Recently uploaded (20)

PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Essential Infomation Tech presentation.pptx
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
System and Network Administraation Chapter 3
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
System and Network Administration Chapter 2
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Digital Strategies for Manufacturing Companies
Odoo POS Development Services by CandidRoot Solutions
Navsoft: AI-Powered Business Solutions & Custom Software Development
2025 Textile ERP Trends: SAP, Odoo & Oracle
Essential Infomation Tech presentation.pptx
VVF-Customer-Presentation2025-Ver1.9.pptx
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
System and Network Administraation Chapter 3
Upgrade and Innovation Strategies for SAP ERP Customers
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Reimagine Home Health with the Power of Agentic AI​
How to Choose the Right IT Partner for Your Business in Malaysia
System and Network Administration Chapter 2
PTS Company Brochure 2025 (1).pdf.......
Wondershare Filmora 15 Crack With Activation Key [2025
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
CHAPTER 2 - PM Management and IT Context
Digital Strategies for Manufacturing Companies

Operating system 35 paging

  • 1. Operating System 35 Paging Prof Neeraj Bhargava Vaibhav Khanna Department of Computer Science School of Engineering and Systems Sciences Maharshi Dayanand Saraswati University Ajmer
  • 2. Paging • Physical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter is available – Avoids external fragmentation – Avoids problem of varying sized memory chunks • Divide physical memory into fixed-sized blocks called frames – Size is power of 2, between 512 bytes and 16 Mbytes • Divide logical memory into blocks of same size called pages • Keep track of all free frames • To run a program of size N pages, need to find N free frames and load program • Set up a page table to translate logical to physical addresses • Backing store likewise split into pages • Still have Internal fragmentation
  • 3. Address Translation Scheme • Address generated by CPU 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 unit – For given logical address space 2m and page size 2n page number page offset p d m -n n
  • 5. Paging Model of Logical and Physical Memory
  • 6. Paging Example n=2 and m=4 32-byte memory and 4-byte pages
  • 7. Paging (Cont.) • Calculating internal fragmentation – Page size = 2,048 bytes – Process size = 72,766 bytes – 35 pages + 1,086 bytes – Internal fragmentation of 2,048 - 1,086 = 962 bytes – Worst case fragmentation = 1 frame – 1 byte – On average fragmentation = 1 / 2 frame size – So small frame sizes desirable? – But each page table entry takes memory to track – Page sizes growing over time • Solaris supports two page sizes – 8 KB and 4 MB • Process view and physical memory now very different • By implementation process can only access its own memory
  • 8. Free Frames Before allocation After allocation
  • 9. Implementation of Page Table • Page table is kept in main memory • Page-table base register (PTBR) points to the page table • Page-table length register (PTLR) indicates size of the page table • In this scheme every data/instruction access requires two memory accesses – One for the page table and one for the data / instruction • The two memory access problem can be solved by the use of a special fast-lookup hardware cache called associative memory or translation look-aside buffers (TLBs)
  • 10. Implementation of Page Table (Cont.) • Some TLBs store address-space identifiers (ASIDs) in each TLB entry – uniquely identifies each process to provide address-space protection for that process – Otherwise need to flush at every context switch • TLBs typically small (64 to 1,024 entries) • On a TLB miss, value is loaded into the TLB for faster access next time – Replacement policies must be considered – Some entries can be wired down for permanent fast access
  • 11. Associative Memory • Associative memory – parallel search • Address translation (p, d) – If p is in associative register, get frame # out – Otherwise get frame # from page table in memory Page # Frame #
  • 13. Effective Access Time • Associative Lookup =  time unit – Can be < 10% of memory access time • Hit ratio =  – Hit ratio – percentage of times that a page number is found in the associative registers; ratio related to number of associative registers • Consider  = 80%,  = 20ns for TLB search, 100ns for memory access • Effective Access Time (EAT) EAT = (1 + )  + (2 + )(1 – ) = 2 +  –  • Consider  = 80%,  = 20ns for TLB search, 100ns for memory access – EAT = 0.80 x 100 + 0.20 x 200 = 120ns • Consider more realistic hit ratio ->  = 99%,  = 20ns for TLB search, 100ns for memory access – EAT = 0.99 x 100 + 0.01 x 200 = 101ns
  • 14. Memory Protection • Memory protection implemented by associating protection bit with each frame to indicate if read-only or read-write access is allowed – Can also add more bits to indicate page execute-only, and so on • Valid-invalid bit attached to each entry in the page table: – “valid” indicates that the associated page is in the process’ logical address space, and is thus a legal page – “invalid” indicates that the page is not in the process’ logical address space – Or use page-table length register (PTLR) • Any violations result in a trap to the kernel
  • 15. Valid (v) or Invalid (i) Bit In A Page Table
  • 16. Assignment • Explain in detail the concept of paging