How does computer memory work?

978 views

When you physically save a file, like a photo or a word document, how is it physically saved? Where is that document physically? I believe there are two modern memory devices, HDD and SDD, but how do they work? How can a Hard Disk Drive be ‘scratched’ the right way to save my essays? And when I save a file to a flash drive, where on the flash drive are my documents? How can another computer read that flash drive? Is it a series of electrons or switches moved to remember each part of the document, like the 38th word on the 4th page?

In: Technology

4 Answers

Anonymous 0 Comments

As /u/MrOctantis said, you are talking about data storage, not “memory”; although effectively, they are both “storage” – “memory” is generally used to refer to short term storage for the purpose of running the computer, while disk “storage” is for long term file storage. Your question is clear that you’re asking about the latter.

First thing you need to know is that computers are digital. That means every file in a computer is ultimately made up of zeros and ones. The HDD uses a magnet to magnetize or demagnetize each spot. Magnetized is a “one” and demagnetized is a “zero”.

In a text document, every keyboard character has a specific code of zeros and ones that mean that character (basically just like morse code but with 0 and 1 instead of dot and dash). So the text “hey” would be saved as “01101000 01100101 01111001” (without the spaces). So a pure text file of “hey” would need 24 “bits” of hard drive space to record (word processor files like Word .docs record formatting and a whole bunch of stuff other than just your words, so they are larger).

A hard disk drive has one or more spinning metal discs inside (google it, and you’ll see them). The data is not “Scratched” on them like a vinyl record. You would not “see” any evidence of them having data on them. The disk is mapped out and divided into tiny spots each representing a “bit” of data. It’s not physically divided, just that the programming of the drive has a “map” and knows where on the disc to look for each bit.

The drive also stores in one particular place a list of every file and which spot(s) of the drive that file is stored in. The computer will try to keep your file in a single consecutive line on the disk, but there isn’t always enough consecutive free space for your file, so it may save it in various pieces across the disc.

An ELI5 analogy would be if you had a big page of graph (grid) paper. You wanted to write out a bunch of words, so you did it in morse code. with dots as empty squares and dashes coloured in. But instead of writing in order, you coloured in random squares. Then you had a separate piece of paper that mapped out which squares made up a word, battleship style (A4, D1, E12, X6, H11, etc.)

The discs are read much like a record player. The discs spin and there is an arm that can move from the outside of the disk to the inside – except instead of following a grove in a continuous line, the arm on an HDD moves in an out rapidly to read whatever spots it needs to to access a file. This constant random motion is part of what makes HDDs wear out (fail).

HOW the drives are controlled to look in the right places is all just computer programming to tell the arm how to move to read or write in the correct location, finding an empty spot to write on.

A SSD is just a large flash drive. It is the same basic technology. Both store files on computer chips. It is “non-volatile” storage, which means the data doesn’t disappear when the computer turns off. These chips have a transistor for every bit of data. It’s not really that easy to simplify, but it’s basically part of an electronic circuit that can be in an “on” or “off” state based on whether it’s electrically charged or not. So “charged” is 0 and “not charged” is 1. So in this case, it does have to do with some electrons (That’s what makes it charged).

The difference between flash/SSD memory and HDD is that SSD memory works based simply on sending electricity through the chip. There is no moving magnetic arm. So it’s generally equally fast to read data from anywhere on the chip, whether it’s together or in random places.

HDDs are faster if the data’s all together because the arm doesn’t have to move very much. But they are also slower in general than SSDs because electricity moves faster than a mechanical arm and spinning disc.

You are viewing 1 out of 4 answers, click here to view all answers.