seegongsik
Saved words
Structure

How do you find one cell among billions?

Last time, we said gather billions of memory cells and you get memory. But among all those cells, how do we reach the exact one we want, in a single step?

01

Too many cells and you can't find one

Billions of memory cells.
An enormous amount.
But here a problem arises.
Among this many cells,
how do we find again
which cell holds
"that value we just stored"?
They have no names and look identical.

They all look identical. How do you pinpoint one cell?

Imagine a library with tens of thousands of books
shelved at random
with no numbers.
Finding the book you want
is nearly impossible.
Memory has the same problem.
We need a solution.

02

Give every cell a number

The solution is just like lockers.
Picture lockers at a pool.
Each identical-looking locker
has a number on it.
Number 0, 1, 2.
Memory is the same.
Every cell
gets a number, in order.

#0
72
#1
101
#2
108
#3
108
#4
111

On top is the cell number (address), below is the value it holds.

This number is called an address.
Just as every house has an address
so mail is delivered exactly,
if every cell has an address,
you can reach the exact cell
you want.

03

Call the address and you go to that cell

With an address,
finding is instant.
Say "bring the value in cell 3,"
and memory goes straight to 3
and takes out the value inside.
Even with billions of cells,
if you know the number
you arrive in one step.
Try entering an address.

#0
72
#1
101
#2
108
#3
108
#4
111
#5
0
#6
0
#7
0
Enter an address and press Read

Enter an address and go to that cell.

Going straight to the cell you want
with a single number.
This is the secret to memory's speed.
It doesn't count one by one from the start,
it points by address directly.

04

Put a value in the cell you want

It's not just taking out.
Say "put this value in cell 5,"
and the value is stored there.
Reading is taking out by address,
writing is putting in by address.
These two
are all that memory does.
Try putting one in yourself.

#0
72
#1
101
#2
108
#3
108
#4
111
#5
0
#6
0
#7
0
Enter an address and value, then press Write

Choose an address and put a value in.

Read by address, write by address.
Simple, right?
Yet these two simple actions
are the foundation of every program.
Variables, photos, anything at all
in the end come and go
by address like this.

05

The CPU asks by address

Now the big picture.
When the calculating CPU
needs a value,
it asks memory by address.
"Give me the value in 3,
put this result in 7."
The CPU and memory
exchange addresses
to get work done.

CPUcalculate
Give me #3Here's the value
Memory (numbered cells)

They exchange by address.

With this, the body of a computer,
its basics, we've now circled once.
From 0 and 1,
to calculating, remembering,
and reaching by address.
From here on
we'll see how these parts
follow real commands.

In one linePutting a number on each of the many identical cells, that's an address. Like lockers. The two simple actions of reading by address and writing by address are the foundation of every program.
Was this helpful? Support seegongsik
Structure