Page 1131 - The Mechatronics Handbook
P. 1131
A streaming buffer is used as a prefetching mechanism for cache misses. When a cache miss occurs, the
streaming buffer begins prefetching successive lines starting at the miss target. A victim cache is typically
a small, fully associative cache loaded only with cache lines that are removed from the primary cache.
In the case of a miss in the primary cache, the victim cache may hold additional data. The use of a victim
cache can improve performance by reducing the number of conflict misses. Figure 42.7 illustrates how
cache accesses are processed through the streaming buffer into the primary cache on cache requests, and
from the primary cache through the victim cache to the secondary level of memory on cache misses.
Overall, cache memory is constructed to hold the most important portions of memory. Techniques
using either hardware or software can be used to select which portions of main memory to store in cache.
However, cache performance is strongly influenced by program behavior and numerous hardware design
alternatives.
Virtual Memory
Cache memory illustrated the principle that the memory address of data can be separate from a particular
storage location. Similar address abstractions exist in the two-level memory hierarchy of main memory
and disk storage. An address generated by a program is called a virtual address, which needs to be translated
into a physical address or location in main memory. Virtual memory management is a mechanism, which
provides the programmers with a simple uniform method to access both main and secondary memories.
With virtual memory management, the programmers are given a virtual space to hold all the instructions
and data. The virtual space is organized as a linear array of locations. Each location has an address for
convenient access. Instructions and data have to be stored somewhere in the real system; these virtual
space locations must correspond to some physical locations in the main and secondary memory. Virtual
memory management assigns (or maps) the virtual space locations into the main and secondary memory
locations. The mapping of virtual space locations to the main and secondary memory is managed by the
virtual memory management. The programmers are not concerned with the mapping.
The most popular memory management scheme today is demand paging virtual memory manage-
ment, where each virtual space is divided into pages indexed by the page number (PN). Each page consists
of several consecutive locations in the virtual space indexed by the page index (PI). The number of
locations in each page is an important system design parameter called page size. Page size is usually
defined as a power of two so that the virtual space can be divided into an integer number of pages. Pages
are the basic unit of virtual memory management. If any location in a page is assigned to the main
memory, the other locations in that page are also assigned to the main memory. This reduces the size of
the mapping information.
The part of the secondary memory to accommodate pages of the virtual space is called the swap space.
Both the main memory and the swap space are divided into page frames. Each page frame can host a
page of the virtual space. If a page is mapped into the main memory, it is also hosted by a page frame
in the main memory. The mapping record in the virtual memory management keeps track of the
association between pages and page frames.
When a virtual space location is requested, the virtual memory management looks up the mapping
record. If the mapping record shows that the page containing requested virtual space location is in main
memory, the management performs the access without any further complication. Otherwise, a secondary
memory access has to be performed. Accessing the secondary memory is usually a complicated task and
is usually performed as an operating system service. In order to access a piece of information stored in
the secondary memory, an operating system service usually has to be requested to transfer the information
into the main memory. This also applies to virtual memory management. When a page is mapped into the
secondary memory, the virtual memory management has to request a service in the operating system to
transfer the requested virtual space location into the main memory, update its mapping record, and then
perform the access. The operating system service thus performed is called the page fault handler.
The core process of virtual memory management is a memory access algorithm. A one-level virtual
address translation algorithm is illustrated in Fig. 42.8. At the start of the translation, the memory access
algorithm receives a virtual address in a memory address register (MAR), looks up the mapping record,
©2002 CRC Press LLC

