Everything in a computer works by sending a pulse of eletricity through it. When a line in a computer has electricity in it we call that 1, when it doesn't 0
By sending this pulse through a line, we can check if it lets electricity through or not
In the first example we had one line with electricity at the start, and one at the end. We went from a value of 1 to another value of 1
In the second example we see what happens when one line is blocked. We go from two values; top start line 1 & bottom start line 1 to end top line 0 & end bottom line 1
1 1 -> 0 1
Congratulations, this is memory!
Addressing Problems
This way you always get ALL memory, which is somewhat inconvenient
So how do we get just part of the memory?
We use switches!
Here the pulse goes straight ahead unless we activate the switch, in that case it goes to the bottom
With this we can route a pulse to a specific part of the memory
Here you can see that the top line always gets a pulse and the other two varies, depending on their values different lines are highlighted at the end before combining into one
The first start line is always 1
The first end line is run through when the other start lines are 0 0
The second end line when it's 0 1
The third when 1 0
And finally, the fourth when it's 1 1
So here we have a memory with four places, called bits
To reach each one we needed two lines, two bits
If we want more memory we need more bits (start lines) to be able to pick each part of it
With 2 bits (start lines) we can reach 4 bits (memory lines), with 4 bits we reach 16, with 8 -> 64
So the amount of memory we can use, rapidly increases with the amount of bits (start lines) we have (more exactly the number of bits squared)
However, why do we just get one bit at a time? If we get two bits at a time (two out lines) we can use twice as much memory at the cost of not getting individual bits
In fact this is what modern computers does, but with 64 bits at a time. They also use as many in lines (bits) as they get out (not required but simplifies everything)
So 64 bits in (plus one that is always on) to get 64 bits out. For a total of 642×64 for each memory block (with additional trixs to be able to access more)
Forgetting
This is all great, we can read! ....but what about writing?
So it turns out this depend on the memory, but most memory used today is both read & writable
What happens is that you send one additional line (bit) in that decides if you are reading or writing
If it's on, the line (bit) will switch to whatever you send into it. Otherwise it will function as normal
Pulse
A little bonus, I have talked a lot of a "pulse". This is nothing but an electrical current that shuts of itself thereby creating "pulses"
Worth noting that all this is simplified
More
If you want something a bit more hands on and complicated I can recommend Digital Logic Sim, where you can build your own memory
Or if you prefer to watch here is an implementation of an 8-bit computer memory in the program