Tuesday, August 19, 2025

C06 Memory - How Computers Remember


How Computers Remember - Memory

Dr Sudheendra S G reviews the fundamental concepts of computer memory, drawing primarily from "How Computers Remember – Memory" by Dr. Sudheendra S. G. The source explains memory from its most basic building blocks to complex modern memory systems, highlighting key components, functionalities, and types.

I. The Fundamental Need for Memory

The core purpose of memory in a computer is to store the results of calculations and maintain program states. As Dr. Sudheendra states, "what’s the point of calculating something if you can’t remember the result?" Memory acts as a temporary or permanent repository for data.

Key Distinction: Volatile vs. Persistent Memory

  • Volatile Memory (e.g., RAM): Requires continuous power to retain data. Loss of power results in loss of stored information. This is analogous to a game state in an RPG disappearing when "your dog trips over the power cable."
  • Persistent Memory (e.g., Hard Drive, SSD): Retains data even without power. These will be discussed in later sessions.

II. Building Blocks of Memory: Latches and Registers

The journey of memory begins with storing a single bit.

A. Storing a Single Bit: Latches

  • Concept: Memory is achieved by creating circuits that "loop back on themselves."
  • Limitations of Simple Loops:OR gate loop: "once you turn it on (1), it stays on forever — but you can’t turn it back off."
  • AND gate loop: "once you turn it off (0), it stays off forever."
  • The AND-OR Latch (Memory Cell): Combining AND and OR gate loops creates a functional memory cell.
  • It has a Set input (to save a 1) and a Reset input (to save a 0).
  • The output remembers the last thing you told it.
  • This is the foundational component that "can remember 1 bit of information."

B. Writing and Reading Data To make latches practical, two features are added:

  • Single Data wire: Replaces separate Set/Reset inputs for simplicity.
  • Write Enable wire: Acts "like a switch to allow changes."
  • Write Enable = OFF: Memory is "locked, no changes."
  • Write Enable = ON: "the data line can change the stored value."
  • Gated Latch: This enhanced latch enables controlled writing and reading of data, representing "real memory in action."

C. From Bits to Registers

  • Registers: To store numbers larger than a single bit, multiple latches are placed "side by side."
  • "8 latches = 8 bits = 1 byte."
  • Registers act as "tiny buckets that hold single numbers."
  • Evolution of Registers: Early computers used 8-bit registers, progressing to 16-bit, 32-bit, and currently common 64-bit registers in modern CPUs.

III. Organizing Memory: Grids, Addresses, and Multiplexers

Storing large amounts of data efficiently requires organized structures.

A. Memory Grids (Matrices)

  • Problem: Individually wiring hundreds or thousands of bits is impractical (e.g., "A 256-bit register would need 513 wires!").
  • Solution: Arranging latches "in a matrix — rows and columns, like city streets."
  • Accessing a Specific Latch: To write to or read from a specific latch, both its row and column wires are activated. A Write Enable wire ensures only the targeted latch updates.

B. Addresses and Multiplexers (MUX)

  • Addresses: Each memory cell in the grid is assigned a unique "address — like 12th Avenue and 8th Street in a city." These addresses are typically represented in binary (e.g., "Row 12 (1100 in binary) + Column 8 (1000 in binary) → Address = 11001000").
  • Multiplexer (MUX): A "component called a Multiplexer (MUX)" is used to select specific rows or columns based on a binary address. It functions "like a traffic cop directing electricity."

C. Scaling Up: From Bits to Billions of Bytes

  • Byte Organization: To store bytes instead of individual bits, "8 grids side by side" are used, with each grid storing one bit of a byte. This allows for storing "256 bytes at 256 addresses" in a 256-bit grid arrangement.
  • Address Space: The number of bits in an address determines the maximum memory capacity:
  • 8-bit addresses: 256 bytes
  • 32-bit addresses: 4.3 billion bytes (4 GB)
  • 64-bit addresses: "basically unlimited for today’s needs."
  • This layered organization demonstrates "how modern memory banks are built — layer upon layer of abstraction."

IV. Random Access Memory (RAM) and Other Memory Types

The organized memory discussed above leads to the concept of RAM.

A. Random Access Memory (RAM)

  • Definition: RAM is a type of memory where "you can quickly access any location, in any order."
  • Function: It acts as the computer's "short-term memory," holding "what’s happening now (open apps, game states, documents)."
  • Volatility: A key characteristic of RAM is that "once the power goes off, it forgets everything."

B. Physical RAM Sticks

  • Modern RAM sticks are complex assemblies of components: "8 memory chips soldered onto a board."
  • Microscopic view reveals a hierarchical structure: "memory squares" on chips, then "blocks," "matrices," and finally "individual bits."
  • Evolution of Capacity: From "1 megabyte (a million bytes)" on a 1980s RAM stick to "8 or 16 gigabytes — billions of bytes!" in today's laptops.

C. Other Memory Types (Beyond SRAM) While the built-in memory is Static RAM (SRAM) – which is "super fast, but expensive" – other common types include:

  • DRAM (Dynamic RAM): "uses capacitors, cheaper, most common in PCs."
  • Flash Memory: "used in USB drives and SSDs."
  • NVRAM (Non-Volatile RAM): "keeps data without power." Despite technological differences, all these types share the "same basic idea: storing bits."

V. Conclusion: Abstraction and Future Steps

The journey of understanding computer memory reveals a system built on layers of abstraction. As Dr. Sudheendra illustrates with a "Russian nesting doll," memory starts with a "simple — just one latch storing one bit. But layer after layer, it scales into the billions of bytes in your devices today." The next logical step in computer architecture is to "combine memory with the ALU to finally build a CPU — the beating heart of a computer!"

 


No comments: