Finishing Paging
Objectives
We would like to :
- Finish paging.
Notes
- 9.3.2 Hardware Support
- Page tables are per process.
- And have sizes between 28 entries and 220
- that 1024 x 1024 or 1MB
- And that is a lot to swap in/out on each context switch.
- So the page table is kept in memory, and pointed to by a page table base register (PTBR)
- Swapping this is fast.
- But accessing something in main memory is slow.
- So the translation look-aside buffer (TLB) exists.
- This is a cache for page table entries.
- It is part of each layer of cache.
- See the picture on page 367.
- The implementation would look much like the cache picture we found last time.
- They state hardware TLB's are between 32 and 1024 entries.
- And there might be an i-TLB and a d-TLB
- A simple TLB entry would contain
- A valid bit
- A tag or page number (p)
- A frame number (f)
- Data for implementing replacement policy.
- These are cache and behave like cache
- A TLB miss occurs when the page is not in the TLB.
- The accuracy of hits/trials is the hit ratio
- The time when we have a TLB miss is double (memory for page -> frame value + memory access).
- So we can calculate the average time as follows
- access time = memory access time * hit ratio + 2*memory access time * (1-hit ratio)
- So if memory access is 10ns, and we have an 80% hit ratio
- 10 * .8 + 20 *.2 = 8+4 = 12 ns.
- A more likely hit ratio is 99%. of
- 10 * .99 + 20 * .01 = 9.9 + .2 = 10.1ns
- A similar computation could be done with multiple layers of tlb.
- 90% hit at level 1, no penalty, 99% hit at level 2, 1ns penalty
- 10 * .9 + .1(11 * .99 + 20 * .01)
- By the way, a similar computation works for the 10ns memory access time.
- L1 hit ratio
- L1 miss penalty.
- They state that
- Page table entries in the TLB might be "hard wired" or made semi permanent.
- Kernel pages for example.
- More advanced addressing schemes are available.
- This scheme really helped me understand shared libraries
- We need the executable to support relocatable code for these libraries
- They can be stuck in memory in pages that are common among all processes using them.
- The pages can be marked read only.
- They mention multiple schemes for much larger memory, but time...