What is cache memory Cache is faster type

  • Slides: 11
Download presentation
What is cache memory?

What is cache memory?

Cache is faster type of memory than is found in main memory. In other

Cache is faster type of memory than is found in main memory. In other words, it takes less time to access something in cache than in main memory. It ‘sits’ between external memory (main memory) and the processor. Runs at the speeds close to that of the processor and has two main types.

l L 1 which stores instructions going to the processor. Often split into two

l L 1 which stores instructions going to the processor. Often split into two L 1 cache for instructions and L 1 cache for data. l L 2 which is used buffer data between L 1 cache and main memory, sometimes called unified cache.

Principle of locality l l l The nature of programs and structure of data

Principle of locality l l l The nature of programs and structure of data often means that requests to memory are not random, but localised. Programs tend to reuse data and instructions that have been recently used – temporal locality. Instructions and data referenced closed together in time, or often close together physically in memoryspatial locality.

When data is transferred between main memory and the processor, a copy of the

When data is transferred between main memory and the processor, a copy of the data is saved to cache. l. When the processor needs more data, the addresses are checked to see if the data is already in the cache, if it there is no need to transfer the data from main memory which is slower. l. This is a cache hit and the data is taken directly from the cache. l. If the data is not, in the cache, this is known as a cache miss and a memory transfer is performed.

The ability to store more data in a cache will makes the computer faster,

The ability to store more data in a cache will makes the computer faster, so bigger caches are an advantage. However, cost is a limiting factor as this type of memory is more expensive than main memory.

Comparison of speeds for cache and main memory Processor 486 Pentium III Pentium 4

Comparison of speeds for cache and main memory Processor 486 Pentium III Pentium 4 CPU (MHz) 100 233 450 550 2000 L 1(ns) 10 4 2 2 0. 5 L 2(ns) 30 15 4 4 0. 5 main memory(ns) 60 60 60 10 1. 2 Data taken from Dick D (2002) The P. C. Support Handbook page 120.

Harvard Architecture l l Instruction and data memories occupy different address spaces. That is,

Harvard Architecture l l Instruction and data memories occupy different address spaces. That is, there is an address 'zero' in instruction space that refers to an instruction storage location and also an address 'zero' in data space that refers to a distinct data storage location. Instruction and data memories have separate hardware pathways to the central processing unit (CPU).

Summary l. There is hierarchy of memory. The higher level in the hierarchy a

Summary l. There is hierarchy of memory. The higher level in the hierarchy a device the more expensive, less that can be stored, but it is but the quicker to access. l. Cache, a form of RAM, ‘sits’ between external memory (main memory) and the processor. Runs at the speed of the processor and has two main types. – L 1 which stores instructions going to the processor. – L 2 which is used buffer data from memory.

l Harvard architecture – – Instruction and data memories occupy different address spaces. Instruction

l Harvard architecture – – Instruction and data memories occupy different address spaces. Instruction and data memories have separate hardware pathways to the central processing unit (CPU).

Sources for further reading l Chalk et al (2004) Chapter 6 pages 101 -107

Sources for further reading l Chalk et al (2004) Chapter 6 pages 101 -107 l Dick D (2002) The P. C. Support Handbook page 120.