9. Virtual Memory Flashcards
What main problems are addressed by virtual memory?
Capacity (we wish for the physical memory to be smaller than the address space)
Safety (we want to prevent user programs from accessing the memory used by the OS and want to make sure that user programs cannot interfere with each other)
Give a brief summary of the concept of virtual memory.
Each program thinks it owns the entire memory –> the virtual address space.
Virtual addresses are translated to physical addresses by the OS and hardware.
Swap space is located in which memory?
Secondary.
What is a page?
The equivalent to a block of virtual memory. Page sizes tend to be 4-16 KB.
Mapping is done through a page table.
Does a cache or physical memory have a higher miss rate?
Cache.
A virtual address is divided up into what parts in a page table?
Virtual page number (equivalent of tag) and page offset.
Does virtual memory use write-through or write-back?
Write-back
How does the computer know where the page table for a program is stored?
The start of the table is pointed to by the page table register.
Why is no tag required for a page table?
Each page has its own mapping.
What acts like the index in a page table?
The full block address (virtual page number)
Describe how a virtual address is translated into a physical address.
The first 20 bits of the virtual page number is the index of the page table. The 18-bit address at that entry is the physical page number.
The last 12 bits are the offset, and are kept the same.
The physical page number is added to the front of the offset to get the physical address.
What is the size of the page table given a 32-bit virtual address space, 4 KB physical pages and 1 GB of main memory?
4 KB = 4000 B, so 12 bits are required for offset.
Then, we have 20 bits for virtual page number.
1 GB = 1,000,000,000 B, so 30 bits are needed for the physical address. We therefore have 18 bits for virtual page number.
There are 220 entries in the table with 18 bits required for each.
Thus, 18*220 bits = 2.25 MB
What are the ARM special bits in a page table?
Access (set when the page is accessed, and reset periodically)
Modified (set if data needs to be written back to disk)
Residence (set if page table is in memory)
What bits control the permissions of a particular entry in a page table?
W (read & write)
R (read only)
X (execute only)
What is the only manager that can edit a page table?
Operating System.