The operating system often provides the use of virtual memory to user programs since physical memory is inadequate to support all the programs that we wish to run. Even with virtual memory, we often run out of memory and programs start crashing. Remember, it is important to have amble amounts of physical memory ready.
There are core concepts that need to be addressed in order to understand virtual memory. First, what is virtual memory? Virtual memory is a logical structure of finite memory space allocated to a particular program. The size of virtual memory often exceeds the capacity of the system's physical memory, although it needs not to. Thus, virtual memory enables the program to use more space than is available on the system.
We also need to understand the definition and uses of a page table, translation lookaside buffer, page, frame, and page fault. We will start from the hardware side and progress towards the software aspects.
Physical memory such as Random Access Memory (RAM) is a contigious array of fixed size block memory. These blocks make up a frame. In one sense, a frame is simply a fixed size region of physical memory. A frame does not necessarily represent a block, since one or more blocks may make up a frame. This is up to hardware manufactures to produce.
Then we have the translation lookaside buffer (TLB), which normally resides in the processor or motherboard chipsets. The TLB performs quick checks to determine if the virtual address requested by the program resides in physical memory. If not, additional procedures are required. Recall that memory can live outside the physical memory such as on the hard drive which may lead to page swapping.
In the software side, we have a contigious region of memory. Similar to frames, the virtual memory is made up of fixed size blocks called page. Each page in virtual memory is mapped to a corresponding frame in physical memory.
Since the TLB has to be very quick, it can only have a small and limited size. In order for the program (operating system) to remember which pages are in physical memory, a page table is used. The page table lists all pages that live in physical memory. A page fault occurs when the page requested does not live in physical memory, thus an expensive request is made to fetch it and put it into physical memory.
WS978X I truly appreciate this post.Really thank you!
Im grateful for the article post.Much thanks again. Keep writing.
Really appreciate you sharing this blog post.Really looking forward to read more. Really Great.
I really like and appreciate your blog.Really looking forward to read more. Great.
Really informative blog post.Really thank you! Keep writing.