CS420: Operating Systems Paging and Page Tables
CS420: Operating Systems Paging and Page Tables
MNK
YORK COLLEGE OF PENNSYLVANIA
JHG
'@OK
James Moscola
12
Department of Physical Sciences
CS420: Operating Systems Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne
Paging
• To run a program of size N pages, need to find N free frames and load program
- 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
p d
m-n n
!
page number page offset
! p d
! m-n n
!
• Example setup:
- n=2 and m=4 (p and d are each 2-bits)
• Example:
- Logical address 10 is in page 2 at offset 2
!
page number page offset
! p d
! m-n n
!
• Example setup:
- n=2 and m=4 (p and d are each 2-bits)
• Example:
- Logical address 4 is in page 1 at offset 0
!
page number page offset
! p d
! m-n n
!
• Example setup:
- n=2 and m=4 (p and d are each 2-bits)
• Example:
- Logical address 7 is in page 1 at offset 3
• The two memory access problem can be solved by the use of a special fast-
lookup hardware cache of associative memory called translation look-aside
buffers (TLBs)
- Lookup page number in TLB to quickly determine the frame number
• On a TLB miss, value is loaded into the TLB for faster access next time
- Replacement policies must be considered (which entries to overwrite when TLB
is full)
- Some entries can be wired down for permanent fast access (entries for kernel
code)
- “invalid” indicates that the page is not in the process’ logical address space
- For portions of the process that are not shared, each can have it own pages