How does a computer remember?
So far we've calculated with gates. But a gate, once its input is gone, loses its output right away. So how do we remember a value? There's one very clever move.
Let go and it vanishes at once
A gate has one weakness.
Its output only shows
while the input is coming in.
Press the button and the light turns on,
but the moment you let go
it goes right out.
Try it yourself.
See what happens when you release.
Press the button, then let go.
This way you can calculate
but can't remember.
You can make a number for a moment,
but it flies away the instant you let go.
We need another way
to hold a value.
It feeds its own output back to itself
The clever move is this.
Take the gate's output,
and feed it back
into its own input.
Then something curious happens.
Once it's on,
that on signal
keeps turning itself on.
Even when the input is gone,
it holds on its own.
The output goes back to the input.
This feedback loop
is the heart of memory.
Like two people
standing while holding each other up,
the circuit props up
its own state by itself.
Put a value in and it stays
With this feedback circuit
we make a slot that remembers one value.
Press the "remember" button and it becomes 1,
press the "erase" button and it becomes 0.
The key is,
even when you let go of the button,
that value stays.
Try it yourself.
Put a value in, then let go.
The value stays even after you let go, right?
This is memory.
This little slot
is called a flip-flop.
It means a flick sends it to one side
and it stays there.
Write it down, read it back later
The use of memory
shows after time passes.
Write a value now (writing),
check it again much later (reading),
and it's still there.
This "write and read"
is the basic action of all storage.
Press play and follow along.
Write, wait, read.
A value you wrote
reads back the same even after time.
Thanks to this simple promise,
a computer can briefly hold
the calculation it just did,
and the letters you typed.
Gather lots of these slots and it's memory
One flip-flop
remembers 1 bit, just a 0 or a 1.
So what if you gather many?
Gather eight for one character (one byte),
gather billions
and it becomes a photo, a song.
Turn on the slots below.
One slot is one bit.
The circuit that calculates (the adder)
and the circuit that remembers (the flip-flop),
these two are the pillars of a computer.
Next time we'll see
how this gathered memory
gets a name tag (an address)
so we can find the exact slot we want.