无分页机制下内存访问时间计算及IA32分页问题咨询
Let's break this down step by step—starting with the simplest scenario, then diving into the nitty-gritty of IA-32 paging mechanics.
1. Memory Access Time Without Paging
When there's no paging enabled, the CPU treats the logical address directly as the physical address. There's no need to look up any page tables or do extra indirection—you just access the memory location straight away.
Given the memory access time is 100ns, that's your total access time here: 100ns. No extra overhead, just a single trip to memory.
2. IA-32 Paging: Logical to Physical Address Translation
First, let's recap how IA-32 splits 32-bit logical addresses for both small (4KB) and large (4MB) pages:
For 4KB Small Pages (Two-Level Paging)
A 32-bit logical address is split into three parts:
- Top 10 bits: Page Directory Index (PDI) → picks an entry in the page directory
- Middle 10 bits: Page Table Index (PTI) → picks an entry in the page table pointed to by the directory entry
- Bottom 12 bits: Page Offset → the byte position within the 4KB page
Your target logical address is 0x00ffffff (binary: 00000000 11111111 11111111 11111111):
- PDI:
0x000(first 10 bits are all 0s) - PTI:
0x3ff(middle 10 bits are all 1s) - Offset:
0xfff(last 12 bits are all 1s)
Access Time for 4KB Pages (No TLB)
Without relying on the TLB (Translation Lookaside Buffer) for caching, you need three separate memory accesses:
- Fetch the page directory entry (100ns)
- Fetch the page table entry using the address from the directory entry (100ns)
- Access the target physical memory using the page frame address from the page table entry plus the offset (100ns)
Total time: 100ns + 100ns + 100ns = 300ns
For 4MB Large Pages (Single-Level Paging)
A 32-bit logical address is split into two parts:
- Top 10 bits: Page Directory Index (PDI) → picks an entry in the page directory (this entry directly points to a 4MB page frame)
- Bottom 22 bits: Page Offset → the byte position within the 4MB page
For 0x00ffffff, the bottom 22 bits are 0x3fffff (since 2^22 equals 4,194,304), and the PDI remains 0x000.
Access Time for 4MB Pages (No TLB)
With large pages, you only need two memory accesses:
- Fetch the page directory entry (100ns)
- Access the target physical memory using the page frame address from the directory entry plus the offset (100ns)
Total time: 100ns + 100ns = 200ns
内容的提问来源于stack exchange,提问作者sid chawla

