Download Cache Memory - Principles of Computer Architecture - Lecture Slides and more Slides Advanced Computer Architecture in PDF only on Docsity!
Cache Memory
- Historically, CPUs have always been faster
than memories. In order to have a memory as
fast as a CPU it must be located on the CPU
chip. This makes the chip bigger and more
expensive.
- By combining a small fast memory with a large slow memory, we can get the speed (almost) of the fast memory for the price of the slow memory. The fast memory is called a cache.
Cache Memory
- Basic idea: most heavily used memory words are
kept in the cache. When a memory word is required, the CPU first looks in the cache. If the word is not there, it looks to main memory.
- In order to be successful, a large percentage of the words searched must be in the cache. We can ensure this by exploiting the locality principle. When a word is referenced, it and some of its neighbors are brought into the cache, so next time it can be accessed quickly.
Cache Memory
- Using the locality principle, main memory and cache are divided up into fixed-size blocks. When referring to the cache, these blocks are called cache lines. When a cache miss occurs, the entire cache block is loaded.
- Instructions and data can either be kept in the same cache ( unified cache ) or in separate caches ( split caches ). - There can also be multiple caches (on chip, off chip but in the same package as the CPU, and farther away).
Cache Memory
SIMM Modules
SIMM Modules
SO-DIMM
Secondary Memory
- No matter how fast main memory is, it is
always too small.
- The traditional solution is a memory hierarchy
in which we have small amounts of fast,
expensive memory, and increasingly larger
amounts of slower, less expensive memory.
The storage capacity increases the further we
go down the hierarchy.
Magnetic Disks
- A magnetic disk consists of one or more
aluminum platters with a magnetizable coating. They are typically 3 to 12 cm in diameter.
- A disk head floats over the surface of the disk. The
disk head can magnetize the surface or read the bits previously stored.
- The circular sequence of bits written as the disk
makes a complete rotation is called a track. Each track is divided into fixed-length sectors.
Magnetic Disks
- Sectors typically consist of a preamble (for head
synchronization), followed by 512 data bytes. Following the data is an Error-Correcting Code, either a Hamming code, or more commonly, a code that can correct multiple errors called a Reed-Solomon code. Between consecutive sectors is a small intersector gap.
- Disk arms can move to different radial distances
from the spindle. At each distance, a track is written.
Magnetic Disks
- In order to achieve high quality, most disks are sealed at the factory to prevent dust from entering. These disks are called Winchester disks.
- Most disks consist of multiple platters stacked vertically. Each surface has its own arm and head, but they move together. The set of tracks at a given radial position is called a cylinder. - Disk performance depends on seek time (moving the arm to the right cylinder) and rotational latency (spinning the disk to the right sector).
Magnetic Disks
IDE Disks
- Early PCs had a disk controller on a plug-in card. The OS read from and wrote to the disk by putting parameters in CPU registers and then calling the BIOS ( Basic Input Output System ), located in the PCs ROM. The BIOS then issued the machine instructions to load the disk controller registers and initiate transfers.
- By the mid 1980s, the controller was no longer on a separate card, but closely integrated with the drive. These drives were called IDE ( Integrated Electronic Drives ).
IDE Disks