Lecture 5 Flashcards
What is virtual memory and its purpose?
Virtual memory extends the apparent size of physical memory using secondary storage, optimizing the use of main memory and hard disk.
What are the main components involved in virtual memory?
Cache memory, virtual memory, and the Translation Lookaside Buffer (TLB).
Describe the address translation process in virtual memory.
Virtual address received.
Check TLB for a match.
If TLB hit, obtain physical address and access cache.
If cache miss, fetch data from main memory to cache.
If TLB miss, check PT.
If PT hit, update TLB and fetch data.
If PT miss, load page from disk, update PT, TLB, main memory, and cache.
What is a page fault and how is it handled?
A page fault occurs when a memory page is not mapped to physical memory. It requires mapping the page into the virtual address space and possibly loading it from disk.
What is a page in virtual memory and its typical size?
A page is a collection of memory words moved between disk and main memory, typically ranging from 2K to 16K bytes.
What is the function and structure of a Page Table (PT)?
The PT maintains mappings of virtual pages to physical pages. It includes fields for the virtual page number, physical page number, valid bit, dirty bit, and access permissions.
What do the valid and dirty bits in a Page Table indicate?
The valid bit indicates if the page is in main memory. The dirty bit indicates if the page has been modified while in main memory.
What are the address fields in a virtual memory address?
Virtual Page Number and Offset.
What are the main page replacement policies?
Random Replacement
FIFO (First In, First Out)
Clock Replacement
OPT (Optimal Page Replacement)
LRU (Least Recently Used)
What is segmentation in memory design?
Segmentation divides memory into blocks of varying size, used for relocating programs and providing protection.