eli5 How does a computer store and read data?


What mechanism is used for it? How does it work?

In: 2

0 and 1. Either a space stores a zero or a one. By using logic gates the earliest computers could do things like “if these two numbers are both 1 then I give a 1, or any combination you like”.
Now the truly fun part is turning a bunch of 0 and 1s into useful data. This is where more powerful computers have more bits in their hardware and software.
Let’s take the number 1 as binary in base 8
Counting from the back you start with the number 1 and then double moving forward
0000 0001 is 1
0000 0010 is 2 because you have no 1’s and one 2
0000 0011 is 3, one 1 and one 2.

This can be used to store letters and such as long as everyone agrees on the order and syntax used. This is what a programming language and then the operating system handles.
Since data is stored and passed on as either a 1 or 0 it can be stored magnetically or electrically.

It varies based on the medium. Optical discs (DVDs etc) do it by altering the amount of light that is reflected/absorbed, hard disc and old tape discs use alterations of the magnetic field, and SSDs use a special kind of microchip that doesn’t require active power to retain its state

What they all have in common, is they have the ability to force a transition in their physical medium, which is persistent without power, and is consistent in the degree of change.

This means if I do the same thing to two different storage devices, they’ll both have the same state when I check them later. Depending on the device, I can then convert that state into 1s and 0s in a way that is consistent for all devices of that type

imagine you have a notebook that is blank

when you want to save something in it, you write it down in the first available place. At the same time, you create a table of contents so you can quickly reference it.

This is all fine until you fill up the entire notebook. What do you do? You find some older entry that is no longer needed, so you delete it. At the same time, deleting the table of contents reference of it. Afterwards, you see there is a blank space there, so you write new information into it’s space. Since it’s a limited amount of space, you need to ensure that info you’re writing is smaller, so it can fit. therefore, there is left over blank space… so you make sure the table of contents also reflects this small amount of blank space.

do this a few thousand times and you will have a few thousand slivers of blank spaces. Too small to fit an entire entry into it, but all together it equates a whole entire page worth of blank space. Instead of just wasting that space, you decide you will use it.

you break up your new information that you wish to record so that you fill in each space to it’s max, jumping from page to page, to use each sliver, for just a single letter of multiple words that make up the entire sentence. You use the table of contents to record that all these incomplete entries are actually all part of a full entry.

Do this a few thousand times, the deleting, filling, and using the fragments of slivers to save info, and you will have a notepad of fragmented data but is perfectly recorded/organized int he table of contents.

in a computer, it’s the same way, but instead of words and phrases, you have 1’s & 0’s to represent data and you have File Systems that manages the disk space.

what i just described is for Hard Disk Drives that saves data to disks… but that’s the same basic concept that is used to write to magnetic tape reels (think early computers) and Solid State Drives (SSDs) but with electric pulses and transistors.

There are two ways modern computers store data to be read later. The first is the hard disk drive (HDD). The hard disk drive are a stack of disks which store the 1s and Os as magnetism. In order to access all the disks there’s a stack of read write arms that can either impart a magnetic polarity or read one. The big limiting factor to a HDD is how fast the disks spin and how fast the arms can dart around to read the data.

The faster way is what your phone uses. These are called Solid state drives (SDD). Instead of using magnetism we store a charge itself that can then be read later. A charged cell is a 1 and and empty cell is a 0. Because there are no moving parts we aren’t limited by how fast we can move something.

Data can be stored in a dizzying amount of ways, and all data is read using logical rules.

For example – hard drives store data magnetically. Inside every hard drive is an array of disks that have billions of tiny little spots that can be independently magnetised or demagnetised. If a spot is magnetised, that is interpreted as a 1, and if it’s demagnetised, that is interpreted as a 0.

Solid state drives, on the other hand, store data electronically – it uses billions of transistors to isolate tiny little pockets of charge, where a charged pocket is a 1 and an uncharged pocket is a 0.

DVDs and CDs are also different, using optical effects to represent data – instead of magnetism, the disc is filled with tiny little pits in the surface. A laser is shone on the disc, and the light will be reflected in two different ways depending on whether it hits a pit or a flat area. Again, we now have a way of representing a 0 and a 1 for binary data.

Between 1950 and 1970, the most popular form of data storage was magnetic-core memory, where tiny little metal rings were threaded between two sets of wires to create a lattice of loops that could be physically flipped one way or another depending on the charge of the wires, and the physical orientation of the loops was used to represent 0 and 1 states.

Basically, literally any possible arrangement of things – magnets, charges, objects, whatever – that has two possible states (uncharged and charged, left and right, light and dark) can be used as a way of representing binary data. All you need is one state for zero, and one state for one. An arrangement of empty beer cans sitting on a wall, where a can is a one and an empty space is a zero, could a way of ‘storing’ digital data.

At the very simple end of things, computers ‘read’ data using the same mechanism by which computers ‘think’ – they interpret electronic signals (ones and zeroes) using logical processes, that are created using transistors; tiny little devices which can either accept, amplify, or block current. They can be chained together in complicated ways to produce logical ‘gates’ (if input A, do output B, elsewise do output C etc) that can themselves be chained together to make a device which can perform an infinite and arbitrary amount of calculations. Such a device is said to be *Turing complete.*