E the instructions in the loop are executed again and

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: re very active data and instructions during processing. Since the cache memory is faster than main memory, the processing speed is increased by making data and instructions needed in present processing available in the cache., The obvious question that arises is how can the system know in advance which data and instructions are needed in present processing so as to make it available beforehand in the £ache. The answer to this question comes from a principle known as locality of reference. According to this principle, during the course of execution of most programs, memory references by the processor, for both instructions and data, tend to cluster. That is, if an instruction is executed, there is a likelihood of the same instruction being executed again soon. This is true because most programs typically contain a number of iterative loops (such as while and for loops). Once a loop is entered during the execution of a program, there are repeated references to a small set of instructions (i.e., the instructions in the loop are executed again and again several times). A branch instruction (such as a go to statement) upsets the locality of reference to instructions, but such instructions do not occur frequently in well written programs. Locality of reference is true not only for references to program instructions but also for references to data. For example, operations on tables, arrays, and records in a file involve access to a clustered set of data words. Over a long period, the instructions or data clusters in use change, but over a short period, the processor primarily work's with fixed clusters of instructions and data resulting in clustered memory references. Based on the feature of locality of reference, the effective use of a cache is made in the following manner. As shown in Figure 7.6, the cache memory acts as a small, fast-speed buffer between the processor and main memory. It contains a copy of a portion of main memory contents. When a program is running and the CPU attempts to read a word of memory (instruction o...
View Full Document

Ask a homework question - tutors are online