CST 334 Week 4 Journal Entry

Virtual Memory

Virtual memory provides abstraction so that processes run with the illusion that they have their own private memory address. To do this, the OS uses a virtual-to-physical address mapping using a page table. Processes are given a virtual address to run on, and that virtual address is mapped to a physical address. The process uses the virtual address to run, and the physical address is kept hidden from the process but helps the process execute. 

To map from a virtual address to its physical address, we need to complete an address translation. Virtual addresses consist of a virtual page number(VPN) concatenated with offset bits. In a page table, VPN is the index for a page table entry(PTE). To find the physical address, we can use the VPN of a virtual memory address to find the PTE of the virtual address and use the right-most bits of the PTE to identify the Page Frame Number. We can concatenate the PFN with the offset bits to obtain our physical address.  



Let’s assume we have the virtual address 10010011 and VPN is 3 bits, PFN is 4 bits and we VPN 100 maps to PTE 0b000001101 on a page table. This means the VPN is 100, and the offset bits are 10011. Since 100 is the index for 0b000001101 and PFN is 4 bits, our PFN is going to be the four rightmost bits, 1101. Our physical address will be the concatenation of the PFN and offset bits, which is 110110011.


Comments

Popular posts from this blog

CST 300 - Week 8

CST 300 - Week 5

CST 300 - Week 4