Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 28: Virtual Memory-Address Translation

Similar presentations


Presentation on theme: "Lecture 28: Virtual Memory-Address Translation"— Presentation transcript:

1 Lecture 28: Virtual Memory-Address Translation

2 Review: Memory management for different systems
Processes are known in advance and can fit in memory Embedded systems, e.g., radios, washing machines, and microwaves Processes are unknown in advance, memory might not be large enough Swapping Virtual memory

3 Review: Swapping Each individual process can fit in memory
But memory cannot fit all processes Memory allocation/de-allocation Bitmap Linked list Dynamic address translation Base register in CPU Process isolation Limit register in CPU

4 Virtual memory What if a single process is larger than memory?
Not all parts of the large process are equally possible to be used Put the parts that are less used in disk The process can still run Load a part from disk to memory when needed

5 Paging: Key idea of virtual memory
Divide a program into fixed-size small parts Called virtual pages or pages Divide the memory into fixed-size small blocks Called page frames Load some pages into page frames

6 An example of paging 64K Virtual Address Space 32K Physical Memory
Divided into 16 pages 4K for each page 32K Physical Memory 8 pages of 4K each

7 Problems in paging Address translation Page fault
When a page that the process is trying to use is not in memory, hardware issues page fault Load in the page into a page frame Which page frame goes to disk? This is called page replacement problem

8 Address translation Process generates a “virtual address”
Virtual address is translated into a physical address Physical address goes onto the bus

9 Address translation: Memory Management Unit (MMU)

10 Address translation via Page Table
Page table is a data structure Each page has an entry in this page table The index of the page is used to find the entry in the page table Each entry stores various information about the page

11 Address translation via Page Table

12 Typical Page Table Entry
Present/absent: 1 if the page is in memory Protection: what operations to the page are allowed Modified: 1 if the page is modified since it is loaded. Also called “dirty” bit Referenced: 1 if the page is read or written Caching disabled: 1 if disabling caching this page

13 Page Fault What if required page not in memory?
MMU reports a page fault to CPU CPU gives control to the OS OS fetches it from the disk Needs to evict an existing page from memory (page replacement policy) Instruction is restarted

14 Performance The address translation is done on every memory reference
The translation better be fast!

15 Question Where is the page table stored? Registers? Memory?

16 Store in registers Need many registers Context switching is slow

17 Store in memory One register to store the start address of the page table Context switching is fast May do paging for the page table itself. Store some page entries in disk if the page table is too large.


Download ppt "Lecture 28: Virtual Memory-Address Translation"

Similar presentations


Ads by Google