| Virtual memory: page table | |||||||||||||
| How large is the page table for 32-bit address range? | |||||||||||||
| Assume 4K block size | |||||||||||||
| Number of table entries: | |||||||||||||
| 232 addresses / 212 addresses per block = 220 blocks | |||||||||||||
| Each table entry: | |||||||||||||
| 18 bits of address + valid bit: use 4 bytes | |||||||||||||
| Total bytes | |||||||||||||
| 4 * 220 = 4MB | |||||||||||||
| Each program (process) has its own page table | |||||||||||||
| Suppose 50 processes running on a system: | |||||||||||||
| 200MB of memory used for page tables! | |||||||||||||
| Alternatives to storing entire page table | |||||||||||||
| - Let page table grow as memory usage grows | |||||||||||||
| - But, stack and heap grow from opposite directions: | |||||||||||||
| Have 2 tables which each grow with memory usage | |||||||||||||
| - Use a hash function on the virtual address | |||||||||||||
| Only need as many entries as number of physical pages | |||||||||||||
| Called inverted page table | |||||||||||||
| Lookup process more complicated | |||||||||||||
| - Allow page table to be paged | |||||||||||||
| Could result in paging loop, but can keep page tables in OS address space | |||||||||||||
| - Multiple levels of page tables | |||||||||||||
| Top level: blocks of pages (64-256), called segments | |||||||||||||