Docsity

Computer Architecture and Organization(Cache Memory), Lecture notes of Computer Architecture and Organization

Partial preview of the text

Download Computer Architecture and Organization(Cache Memory) and more Lecture notes Computer Architecture and Organization in PDF only on Docsity!

EEC 216

Computer Architecture and

Organization

Spring 2020

Lecture

Dr. Mohamed Issa

Chapter 4. Cache Memory

1,2. Location and Capacity

  1. Location —Internal (to computer) - Directly accessible by CPU. - e.g., CPU registers, cache, MM. —External (to computer) - Accessible by CPU via an I/O module (controller). - e.g., Secondary storage disks and tapes.
  2. Capacity —Internal memory - # of bytes (or words) - Word length (8, 16, 32, …bits). —External memory - # of bytes.

Concepts for Internal Memory

  • Word —Natural unit of organization of memory. —Usually holds an integer or an instruction. —Not always the case! —X86: word  32 bits, instruction  1+ words!!
  • Addressable unit (i.e., location) —Smallest location that can be uniquely addressed. —Word, byte, or both. —An A-bit address is needed for a 2A^ addressable units.
  1. Access Methods (1)
    • Sequential —e.g. tape —Memory is organized into units of data, called records. —Start at the beginning and read through in order. —Stored addressing information is needed. —Shared read/write mechanism. —Access time depends on data location & previous location.
  1. Access Methods (2)
    • Direct —e.g. disk —Individual records/blocks have unique address based on physical location. —Access is by jumping to vicinity plus sequential search. —Shared read/write mechanism. —Access time depends on data location & previous location.
  1. Access Methods (4)
    • Associative —e.g. cache —Data is located by a comparison with contents of a portion of the store. —Access time is independent of location or previous access
  1. Performance
    • Access time — Random: time between presenting add. and getting data. — Non-Random: time to position rd/wr mechanism at desired location
    • Memory cycle time — Time may be required for memory to “recover” before next access. — Cycle time = access + recovery
    • Transfer rate — Rate at which data can be moved (e.g. X bps) — Random: R = 1 / Cycle Time (in “data units per second”) — Non-random: R = N / (T (^) N – T (^) A) (in “bps”) - T (^) N : Av. time to read/write N bits. - T (^) A : Av. access time. - N: # of bits. - R: transfer rate.
  1. Organization
    • Key for random-access memory
    • Physical arrangement of bits to form words.
    • Obvious arrangement is not always used. —i.e., Cell rows may not correspond to words!!
    • To be explained more later in internal memory.

Design Constraints on Memory

  • How much? —Capacity: bigger is better!
  • How fast? —Speed: keep up with CPU.
  • How expensive? —Cost: reasonable compared to other components.
  • Problem : Trade-off among these three characteristics!! —No single memory technology has it all!!
  • Solution : memory hierarchy.

Locality of Reference

CPU

Main memory

Locality of Reference

  • During the course of execution of a program, memory references tend to cluster (for both instructions and data). —e.g., loops, subroutines. —e.g., operations on tables and arrays.
  • Over a short period of time, CPU is working with fixed clusters of memory references.
  • Over a long period of time, the clusters in use change.
  • This principle can be applied across all levels of the memory hierarchy.

Cache Memory – Operation

  • CPU requests contents of memory location.
  • Check cache for this data.
  • If present  cache hit, get from cache (fast). —Because of locality of reference, this location, or a close one, is likely to be referenced soon.
  • If not present  cache miss, read required block from MM to cache.
  • Then deliver from cache to CPU.
  • Cache includes tags to identify which block of main memory is in each cache slot.

Cache – Read Operation

Miss Hit