CPSC 3220 - DAY 14 OCTOBER 31, 2017 ================================================================================ Address Translation Concept -How do we convert a virtual address to a physical address? Flexible Address Translation -Base and Bound -Segmentation -Paging -Multilevel translation Efficient Address Translation -Translation Lookaside Buffers -Virtually and physically addressed caches +-------------------+ Virt. +------------------+ | Processor | ------> | Translation | Raise | | Address | | Invalid? ---> Exception +-------------------+ +------------------+ ^ Valid? | | | | +-----------------+ | \-----> | Physical | | Physical | Memory | ^ Memory +-----------------+ DATA | | V | Data | | | | \-----------------------------------------------/ ADDRESS TRANSLATION GOALS ------------------------- -Memory protection -Memory sharing -shared libraries, interprocess communication -Sparce addresses -multiple regions of dynamic allocation (heaps/stacks) -Efficiency -memory placement -runtime lookup -compact translation tables -Portability Virtually Addressed Base and Bounds ----------------------------------- Segment is a contiguous region of virtual memory Each process has a segment table (in hardware) -Entry in table = segment Segment can be located anywhere in physical memory -Each segment has start, length, access permission Process can share segments -Same start, length, same/different access permissions Zero on Reference ----------------- How much physical memory is needed for the stack or heap? -Only what is currently in use When program uses memory beyond end of stack -Segmentation fault in OS kernel -Kernel allocates some memory -How much? -Zeros the memory -Avoid accidentally leaking information -Modify segment table -Resume process