



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A set of lecture notes for the w4118 operating systems course, focusing on paging and page translation in operating systems. It covers topics such as page table structure, page protection, page sharing, and page table management strategies. It also includes examples and exercises to illustrate these concepts.
Typology: Essays (high school)
1 / 27
This page cannot be seen from the preview
Don't miss anything!




















^ Paging^ ^ Overview^ ^ Page translation^ ^ Page allocation^ ^ Page protection^ ^ Translation Look-aside Buffers (TLB)^ ^ Page sharing^ ^ Page table structure^ ^ Combining paging with segmentation
^ Address bits =
page number
+^ page offset ^ Translate^ virtual page number (vpn)
to^ physical page number (ppn)
using^ page table pa = page_table[va/pg_sz] + va%pg_sz CPU^ vpn
off^ ppn
off ppnvpn Page table
ppn^ Memory
Page 0 Page 2 01 14 23 Page 3^
Page 2^ Page 1 Page 3 Page table
PhysicalMemory VirtualMemory
23 37
^ Implemented by associating
protection bits with each virtual page in page table Protection bits^ ^ valid bit: map to a valid physical page?^ read/write/execute bits
: can read/write/execute? ^ read/write/execute bits
: can read/write/execute? ^ Checked by MMU on each memory access
Page 0 vrwe 011100141110230000 Page 3
Page 1 Page 3 Page table
PhysicalMemory VirtualMemory
23 37 1111
points to the base of page table OS stores the value of this register in
process control block (PCB) OS switches PTBR on each context switch OS switches PTBR on each context switch Problem: each data/instruction access requirestwo memory accesses Extra memory access for page table
VPN^ PPN
^ Can be handled in hardware and software ^ Hardware (CISC: x86)^ ^ Pros: hardware doesn’t have to trust OS!^ ^ Cons: complexity ^ Software (RISC: MIPS, SPARC)^ ^ Pros: flexibility^ ^ Cons: code may have bug^ ^ Question: what can’t a TLB miss handler do?
TLB^ entries ^ Option 2: attach process ID to
TLB^ entries ^ ASID: Address Space Identifier ^ MIPS, SPARC
Processes communicate by write to shared pages Memory efficiency.
One copy of read-only code/data shared among processescode/data shared among processes^ ^ Example 1: multiple instances of the shell program^ ^ Example 2: parent and forked child share AS