How a Machine Learned to Remember: Memory and the Clock

Planted 02026-08-01

How can a result survive after the signals that produced it disappear?

How can a machine use an answer after the signals that produced it have disappeared?

How can it perform a second step when the first step leaves nothing behind?

An arithmetic logic unit can add, subtract, compare, and transform values. Control bits can choose which operation it performs. But the ALU lives entirely in the present.

Give it seven and five, and it produces twelve.

Change the inputs, and twelve is gone.

The ALU has not forgotten the answer. It never possessed the answer. Its output was only the current consequence of the signals passing through it.

A sequence requires more.

The result of one moment must survive long enough to become the input to another. The machine must preserve not only values, but the consequences of what it has already done.

It needs a past.

The story of computer memory begins with a strange problem: how do you make a machine remember when the physical thing holding the memory is always forgetting?

1. The answer that disappeared

Imagine asking the ALU to add two numbers:

X = 7
Y = 5
Operation = add

Its output becomes:

12

Now suppose the next step should add three:

12 + 3

The machine has the circuitry to perform the addition. But where will the first result come from?

If the original inputs change, the ALU output changes with them. If the control bits select another operation, the output becomes something else. The twelve does not remain inside the gates as a completed thought.

A person could write the result on paper and enter it again. Human calculators did exactly this: calculate an intermediate value, record it, retrieve it later, and continue.

But then the paper and the person are part of the machine’s memory.

For an electronic computer to follow a long procedure at electronic speed, it needs an internal equivalent of that written note. It needs somewhere a pattern can remain while the rest of the machine moves on.

That requirement seems simple because modern computers make memory feel passive. We imagine values resting in numbered boxes, waiting quietly to be retrieved.

The first electronic memories were not quiet.

They leaked, faded, drifted, and had to be continually repaired.

2. Electronic speed meets mechanical memory

By the end of the Second World War, engineers had built calculating machines whose electronic circuits could operate far faster than relays and other moving mechanisms.

But a fast calculating unit is constrained by the speed at which it can receive and preserve information.

A machine might perform an addition in a fraction of the time required to move a mechanical storage device. If every intermediate result had to wait for a rotating drum, a relay register, punched tape, or some other slower mechanism, the electronic circuitry would spend much of its life waiting.

The machine needed memory with no moving parts.

At Britain’s Telecommunications Research Establishment, Frederic Williams had worked with cathode-ray tubes during wartime radar research. A cathode-ray tube directs a beam of electrons toward a phosphor-coated screen. In radar or television, the beam helps create a visible image.

Williams became interested in another effect.

When the beam struck the screen, it could leave a small electrical charge. Perhaps the presence or absence of that charge could represent a bit.

A charged point on the screen could mean 1.

An uncharged point could mean 0.

The idea promised electronic storage: no wheel to rotate, no metal arm to move, no paper tape to advance.

But the charge did not stay.

It leaked away in less than a second.

The possible memory was continually erasing itself.

3. The dots that would not stay

Williams began experimenting with cathode-ray-tube storage in 1946. Tom Kilburn, a young engineer who had worked with him during the war, joined the effort. When Williams moved to the University of Manchester in 1947, Kilburn continued the work with him.

The challenge was not merely to make a dot appear.

They had to create a complete cycle of remembering:

Write a bit

Find that bit again

Determine whether it was 0 or 1

Restore it before it fades

A metal pickup plate placed near the tube could detect changes associated with the electrical charge on the screen. The system could use that signal to determine what had been written.

But every part of the process introduced uncertainty.

Could the charge be detected reliably?

Could one location be distinguished from the points around it?

Could a bit be read and restored before it decayed?

Could the tube preserve many bits at once without one pattern interfering with another?

Could the process repeat thousands or millions of times without a small error becoming a different number—or a different instruction?

By December 1947, Williams and Kilburn were storing 2,048 bits on a single cathode-ray tube. Each individual mark was still fragile. The system survived by revisiting the marks and renewing them.

The memory did not defeat decay.

It learned to outrun it.

4. Remembering by repetition

A fading electrical mark seems like a poor foundation for memory.

Yet the Williams–Kilburn tube reveals something important: remembering does not always mean holding an object perfectly still.

Sometimes memory is a process.

Detect the existing pattern

Rewrite the same pattern

Detect it again

Each dot lasted only briefly. The pattern endured because the machine continually refreshed it.

This is less like placing a stone in a box and more like keeping a fire alive. The flame at this moment is not made from exactly the same material as the flame a moment ago. Fuel is consumed. Heat moves. Gases change. Yet the organized process persists.

The bit remained meaningful even though its physical embodiment had to be renewed.

Modern computer memory uses different technologies, and not all forms of memory require this particular kind of refresh. But the broader lesson remains:

A stable logical state can be built from physical events that are individually temporary.

Williams and Kilburn still needed to know whether their storage system could survive the demands of a working computer.

A memory test could write patterns and read them back. But a computer would do something harsher. It would read one location, use the result, change another location, jump to a different part of memory, and repeat the process at electronic speed.

Williams concluded that the best way to test the memory was to build a small computer around it.

The memory experiment was about to become a machine.

5. From a fading tube to a logical promise

The Williams–Kilburn tube was one physical way to preserve bits.

A modern chip stores information differently. A magnetic disk, flash drive, transistor-based register, and cathode-ray tube do not share the same internal mechanism.

Yet from the perspective of the larger machine, they can offer a related promise:

Preserve this pattern.
Return it when requested.
Change it only under the agreed conditions.

Nand to Tetris deliberately steps away from the difficult physics of real storage devices. It supplies a data flip-flop, or DFF, as a primitive component.

The DFF provides a simple temporal relationship:

out(t) = in(t - 1)

Its output during the current time step reflects the input from the previous time step.

This is the first component in the course whose behavior cannot be described only by the inputs visible now. To understand its output, we must know what happened before.

That changes the kind of machine we are building.

The earlier gates were combinational. Their outputs were determined by their current inputs.

A circuit containing memory is sequential. Its present output may depend on an earlier state.

The DFF is supplied rather than constructed from NAND gates because reliable physical memory introduces issues of timing and feedback that the simplified hardware language chooses to hide. Project 3 uses the supplied DFF to build a bit register, sixteen-bit registers, increasingly large RAM units, and a program counter.

This is abstraction at work again.

Below the boundary is a physical mechanism for preserving state.

Above it is a promise about time.

6. The circuit that chooses between past and present

A data flip-flop delays a value. But useful memory needs another ability:

Sometimes accept a new bit. Otherwise preserve the old one.

The multiplexer from the previous machine can make that choice.

Imagine two possible inputs:

The previously stored bit
The new input bit

A load signal selects which value will be sent into the data flip-flop:

Previous value ──┐
                 ├── MUX ──→ DFF ──→ Stored output
New input ───────┘

                    Load

The rule becomes:

Load = 0 → preserve the previous value
Load = 1 → accept the new input

When load is 0, the circuit selects its own stored output and feeds it back toward the DFF. The value returns to itself and survives another time step.

When load is 1, the circuit selects the new input. At the next time step, that value becomes the stored output.

This circuit is a one-bit register—the Bit chip in Nand to Tetris.

Its promise is small but profound:

I can distinguish between what I already know and what you are asking me to remember now.

No part of the circuit understands past or present. One pathway carries the old signal. Another carries the new signal. A control bit selects between them.

Memory emerges from a controlled loop.

The multiplexer, first introduced to choose among ALU results, has acquired a second role. It now decides whether history should continue unchanged or admit a new event.

7. The clock creates official moments

A circuit does not change everywhere at once.

Signals require time to travel through gates. One path may be slightly longer than another. When several inputs change, intermediate patterns can appear while the circuitry settles.

Suppose a register is meant to store seven. The wires leading to it may briefly pass through other patterns while the ALU calculates. If the memory accepted every electrical fluctuation immediately, it could preserve a temporary accident instead of the intended result.

The machine needs an answer to a temporal question:

When does a changing signal become the value we mean to keep?

The answer is the clock.

A clock is a repeating signal that coordinates state changes across the machine. It divides continuous physical time into a sequence of agreed moments:

Moment 0 → Moment 1 → Moment 2 → Moment 3

During one interval, combinational circuits are allowed to react. Signals propagate through gates. The ALU works toward its output.

At the relevant clock transition, memory elements capture their selected inputs. What was merely a current signal becomes the state used during the next interval.

The clock does not calculate.

It does not choose which operation the ALU performs.

It does not decide whether a result is important.

It coordinates when change becomes official.

A useful way to imagine the machine is:

Current state

Combinational circuits calculate possible next values

Clock boundary

Selected values become the new state

The clock gives the machine a shared rhythm of consequence.

Before the boundary, a value is being proposed.

After the boundary, it has become history.

8. From one remembered bit to a remembered number

One bit can record only one distinction:

0 or 1

Place sixteen one-bit storage circuits side by side, give them the same load signal, and they can preserve a sixteen-bit pattern together:

Bit 15
Bit 14
Bit 13
...
Bit 1
Bit 0

This is a register.

If load = 1, all sixteen bits accept their new inputs at the next time step.

If load = 0, all sixteen preserve their previous values.

Now the ALU can leave something behind:

Register contains 5

ALU adds 7

ALU output becomes 12

Load = 1 at the clock boundary

Register now contains 12

During the next cycle, twelve can return to the ALU as an input:

Register contains 12

ALU adds 3

Register stores 15

For the first time, one operation can genuinely build upon another without a person copying the intermediate result.

The machine is no longer only a collection of possible transformations.

It has acquired continuity.

A register can preserve a number, but the number need not represent arithmetic. The same sixteen bits might represent a character, a screen position, a color, a machine instruction, or an address.

The register does not know what it remembers.

It remembers the pattern.

9. The problem of remembering more than one thing

One register is enough until the machine needs a second value.

Suppose the machine must preserve:

  • the current total;
  • the number being added;
  • the position of an object;
  • the remaining count in a loop;
  • and several intermediate results.

We could build more registers.

But as soon as many registers exist, the machine faces two new questions:

Which register should be read?
Which register should be changed?

These are selection problems.

The same ideas used inside the ALU return at a larger scale.

To read from several registers, multiplexers can select one output:

Register 0 ──┐
Register 1 ──┤
Register 2 ──┼──→ selected value
Register 3 ──┤
...          │
Register N ──┘

    Address

To write, a demultiplexer can direct the load signal toward one register while every other register preserves its state:

                 ┌──→ load Register 0
Load ── address ─┼──→ load Register 1
                 ├──→ load Register 2
                 └──→ ...

The input value may be physically available to every register. Only the addressed register receives permission to accept it.

The others keep their past.

The address is another binary pattern. Its role is not to become stored data but to identify a location.

With three address bits, the machine can distinguish eight locations:

000 → Register 0
001 → Register 1
010 → Register 2
011 → Register 3
100 → Register 4
101 → Register 5
110 → Register 6
111 → Register 7

The address asks memory a question:

Which remembered pattern are we talking about?

10. Small memories become larger memories

Nand to Tetris builds memory recursively.

Eight sixteen-bit registers become RAM8.

Eight RAM8 units become RAM64.

Eight RAM64 units become RAM512.

The pattern continues through RAM4K and RAM16K.

Each larger memory must solve the same two problems:

Choose the group containing the desired register.
Choose the register inside that group.

The address bits can be divided between those decisions.

For example, some bits select a smaller memory unit. The remaining bits identify a location inside it.

This is not merely a convenient construction exercise. It reveals how scale repeatedly enters computing:

A remembered bit

A register of bits

A small group of registers

A larger group made from smaller groups

The largest memory does not require a fundamentally wiser storage element.

It requires more instances of the same dependable promise, plus a systematic way to locate one among many.

Every additional address bit doubles the number of locations that can be distinguished.

The memory grows exponentially while the conceptual rules remain small.

This is the same pattern we saw with logic gates and the ALU:

Complexity grows through arrangement while the parts remain simple.

11. Random access is a promise about distance

The name random-access memory can be misleading.

It does not mean the machine chooses a location randomly.

It means that any location can be addressed directly. Reaching register 6 does not require reading registers 0 through 5 first.

From the logical perspective of the machine:

Give memory an address.
Memory returns the value stored there.

The address may point near the beginning or near the end. The interface remains the same.

This is another abstraction boundary.

Below it, gates and wires decode address bits, route load signals, and select outputs.

Above it, the rest of the computer can behave as though values occupy numbered locations.

The locations appear uniform:

Memory[0]
Memory[1]
Memory[2]
...

But the numbers do not carry meaning by themselves.

Memory location 42 is not inherently a score, a character, a coordinate, or part of a photograph.

The same stored pattern might be interpreted as:

  • an integer;
  • a negative number;
  • two characters;
  • a set of control bits;
  • a screen pixel pattern;
  • an address pointing somewhere else;
  • or part of an instruction.

Memory preserves differences without understanding them.

It promises location and persistence.

The larger system supplies meaning.

12. The register that remembers what comes next

Most registers preserve data.

A computer also needs to preserve its position in a sequence.

Suppose a plan contains instructions stored at numbered locations:

Instruction 0
Instruction 1
Instruction 2
Instruction 3
...

The machine needs to remember which instruction should be used next.

This is the job of the program counter.

At its core, the program counter is a register. But it needs several possible behaviors:

Preserve the current value.
Increase the value by one.
Load a different value.
Reset to zero.

These behaviors combine the machinery developed across the series.

Memory preserves the current position.

An incrementer calculates the following position.

Multiplexers select whether to preserve, advance, load, or reset.

Control signals determine which possibility becomes the next state.

Current position ──┐
Next position ─────┤
Loaded position ───┼──→ selected next value ──→ register
Zero ──────────────┘

The program counter does not know what an instruction is.

It does not understand order, intention, or progress.

It remembers a number and changes that number according to control signals.

Yet that small behavior gives the machine a place in a continuing process.

A normal register answers:

What value did we preserve?

The program counter answers:

Where are we now?

13. The machine built to test a memory

In the first half of 1948, Williams, Kilburn, and Geoff Tootill built the Manchester Small-Scale Experimental Machine, soon nicknamed the Baby.

Its purpose was not initially to become a practical general-purpose computer. It was built to test whether the Williams–Kilburn tube could function as reliable electronic memory under the demands of real computation.

The Baby’s main memory held thirty-two words of thirty-two bits. The machine could store both numerical data and instruction patterns in its electronic memory.

Preparing a program was laborious. Bits had to be entered through switches. Early attempts produced patterns on the display tube that Williams later described as a “dance of death”: activity without a useful result and without a clear explanation of what had failed.

On June 21, 1948, a seventeen-instruction program written by Kilburn ran successfully. It searched for the highest factor of a number.

The mathematical task was not what transformed computing.

The important fact was where the instructions lived.

They were not only embodied in permanently wired circuits. They were not being supplied one at a time by a person. They were stored electronically in the same kind of memory that held the machine’s working values.

The Baby read a pattern from memory, acted upon it, moved to another pattern, and continued.

The fragile dots on the cathode-ray tube still faded.

The refresh circuitry still had to restore them.

The vacuum tubes and wiring still had to behave correctly through millions of operations.

But the patterns endured long enough to direct a computation.

A machine built to test memory had demonstrated something larger:

A memory could hold not only what the machine knew, but what the machine should do.

The Baby became the first digital electronic computer to execute a program stored in its electronic memory. The broader stored-program idea had emerged through several overlapping projects and lines of influence; its authorship cannot be reduced cleanly to one inventor.

14. What computer memory really is

Computer memory is often described as storage.

That is true, but incomplete.

Memory is the mechanism by which one moment can constrain another.

A gate reacts to current signals.

An ALU transforms current values according to current control bits.

Memory allows the result of that transformation to remain available after the original conditions are gone.

It gives the machine a state.

What happened before

Stored pattern

What can happen next

The physical embodiment may be a fading charge, a magnetic orientation, trapped electrical charge, a transistor circuit, or some other repeatable state.

The logical promise remains:

Preserve this difference.
Return it when addressed.
Replace it only when instructed.

The Williams–Kilburn tube kept its dots alive by continually rewriting them.

The one-bit register preserves its state by selecting between an old value and a new one.

The clock divides change into agreed moments.

Registers hold words.

Addresses distinguish one remembered word from another.

Larger memories arise by composing smaller ones.

The program counter remembers a position in a sequence.

The machine has acquired a past.

But memory alone does not know what to do with what it preserves.

A bit pattern in one location might be data. A bit pattern in another might describe an operation. The memory returns both without distinction.

Something must fetch the instruction pattern, interpret its fields, direct values toward the ALU, decide whether a result should be stored, and tell the program counter whether to advance or jump.

The ALU gave the machine several possible actions.

Memory gave those actions consequences.

Now the machine needed a way to turn remembered instructions into an unfolding sequence of behavior.

It needed a conductor.