Virtual memory is essential for application programs. Virtual memory allows each
ID: 3805477 • Letter: V
Question
Virtual memory is essential for application programs. Virtual memory allows each application program to run within a full address space, regardless of how much physical memory exists and regardless of how many processes are competing for that physical memory. As such, modern operating systems are expected to provide support for virtual memory. However, operating systems cannot support virtual memory unless the underlying processor architecture provides hardware support for virtual memory. In other words, supporting virtual memory requires a combination of hardware support within the processor and software support within the operating system. Processor architectures provide hardware support for virtual memory. For this Discussion, your job is to analyze the support provided by one of those architectures. To prepare: Research a processor architecture and how it supports virtual memory. Analysis of the processor’s support for virtual memory. Do the following:
Summarize how the processor architecture supports virtual memory.
Identify at least two advantages and two disadvantages in its virtual memory support.
Explain what effects (positive or negative) the architecture’s virtual memory support has on application software.
Explanation / Answer
The Translation Lookaside Buffer is the main component of the processor responsible for virtual-memory. Every virtual memory reference can cause two physical memory accesses; one to fetch the appropriate page table entry and one to fetch the desired data. Thus, a straightforward virtual memory scheme would have the effect of doubling the memory access time. To overcome this problem, most virtual memory schemes make use of a special high-speed cache for page table entries, usually called a translation lookaside buffer(TLB). This cache functions in the same way as a memory cache and contains those page table entries that have been most recently used.
Page Faults:
When a virtual address is requested of the hardware – say via a load instruction requesting to get some data – the processor looks for the virtual address to physical- address translation in its TLB. If it has a valid translation it can then combine this with the offset portion to go straight to the physical address and complete the load.
However, If the processor can not find a translation in the TLB, the processor must raise a page fault. This is similar to an interrupt which the operating system must handle.
When the operating system gets a page fault, it needs to go through it’s page-table to find the correct translation and insert it into the TLB.
In the case that the operating system can not find a translation in the page table, or alternatively if the operating system checks the permissions of the page in questing and the process is not authorized to access it, the operating system must kill the process. If you have ever seen a segmentation fault this is the operating system killing a process that has overstepped its bounds.
Should the translation be found, and the TLB currently be full, then one translation needs to be removed before another can be inserted. It does not make sense to remove a translation that is likely to be used in the future, as you will incur the cost of finding the entry in the page-tables all over again. TLB usually use something like a Least Recently Used or LRU algorithm, where the oldest translation that has not been used is ejected in favour of the new one.
To access can then be tried again, and , all going well, should be found in the TLB and translated correctly.
The Translation Lookaside Buffer is the main component of the processor responsible for virtual-memory. Every virtual memory reference can cause two physical memory accesses; one to fetch the appropriate page table entry and one to fetch the desired data. Thus, a straightforward virtual memory scheme would have the effect of doubling the memory access time. To overcome this problem, most virtual memory schemes make use of a special high-speed cache for page table entries, usually called a translation lookaside buffer(TLB). This cache functions in the same way as a memory cache and contains those page table entries that have been most recently used.
Page Faults:
When a virtual address is requested of the hardware – say via a load instruction requesting to get some data – the processor looks for the virtual address to physical- address translation in its TLB. If it has a valid translation it can then combine this with the offset portion to go straight to the physical address and complete the load.
However, If the processor can not find a translation in the TLB, the processor must raise a page fault. This is similar to an interrupt which the operating system must handle.
When the operating system gets a page fault, it needs to go through it’s page-table to find the correct translation and insert it into the TLB.
In the case that the operating system can not find a translation in the page table, or alternatively if the operating system checks the permissions of the page in questing and the process is not authorized to access it, the operating system must kill the process. If you have ever seen a segmentation fault this is the operating system killing a process that has overstepped its bounds.
Should the translation be found, and the TLB currently be full, then one translation needs to be removed before another can be inserted. It does not make sense to remove a translation that is likely to be used in the future, as you will incur the cost of finding the entry in the page-tables all over again. TLB usually use something like a Least Recently Used or LRU algorithm, where the oldest translation that has not been used is ejected in favour of the new one.
To access can then be tried again, and , all going well, should be found in the TLB and translated correctly.
Advantages:
The primary advantage of virtual memory systems is the ability to load and execute a process that requires a larger amount of memory than what is available by loading the process in parts and then executing them.
The Advantage lies in the ability of the system to eliminate external fragmentation.
Disadvantages:
The disadvantage is that virtual memory systems tend to be slow and require additional support from the system’s hardware for address translations.
It can be said that the execution speed of the same process with virtual memory turned off. Hence we do not have an advantage with respect to the execution speed of the process.
The other disadvantage of virtual memory systems is the possibility of trashing due to excessive paging and page faults.
In may be noted that Trash point is a point after which the execution of a process comes to a halt, the system is busier paging pages in and out of the memory than executing them.
Effects:
Paging:
Virtual memory breaks programs into fixed size blocks called pages. If a computer has abundant physical memory, the operating system loads all of a program’s pages into RAM. If not, the OS fits as much as it can add runs the instructions in those pages. When the computer is done with those pages, it loads the rest of the program into RAM, possibly overwriting earlier pages. Because the operating system automatically manages these details, this frees the software developer to concentrate on program features and not worry about memory issues.
Multiprogramming:
Virtual memory with paging lets a computer run many programs at the same time, almost regardless of available RAM. This benefit, called multiprogramming, is a key features of modern PC operating systems, as they accommodate many utility programs such as printer drivers, network managers and virus scanners at the same time as your application web browsers, word processors, email and media players.
Paging file:
With virtual memory, the computer writes program pages that have been recently used to an area on the hard drive called a paging file. The file saves the data contained in the pages, if the program needs it again, the operating system reloads it when RAM becomes available. When many programs compete for RAM, the act of swapping pages to the file can slow a computer’s processing speed, as it spends more time doing memory management chores and less time getting useful work done. Ideally, a computer will have enough RAM to handle the demands of many programs, minimizing the time the computer spends managing its pages.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.