How does computer store everything which is saved even after switching off?


How does computer store everything which is saved even after switching off?

In: 0

Computers have two different categories of storage. Long term storage, and short term storage.

Short term storage is wiped as soon as the power is turned off.

The long term storage like, hard drives, CDs, thumb drives, tapes, etc etc. All store data in a way that does not require constant electricity to keep the 1s and 0s in their place. Some use magnetic fields, some use physical pits and flats.

Flash memory which is the coolest, for ELI5 purposes I will say that it essentially captures the electricity to hold it, but does not require electricity to do so. Much like how putting water in a bucket does not require any additional energy to keep it there, only to add and remove the water.

For a long while, and in many computers still today, you have the hard drive which has magnetic plates. So the magnetic plates store a magnetic charge which can be read. And this is a physical property of the disk that doesn’t require power.

Today, a new technology called SSD is replacing magnetic disks. SSDs use specific configurations of transistors to store electrical charges and can hold onto these charges for quite a while without needing power.

There are multiple levels of “switching off”.

Closing your laptop/putting to sleep: The RAM remains powered and the MCU is put into a low power mode. Everything is still on, it’s just using the minimum amount of power to maintain the state.

Hibernate: Saves needed RAM information to the hard drive and then cuts power to almost everything. When you turn it on again it loads the RAM from the hard drive.

Shutdown: Writes any stuff that was cached, but not yet save to the hard drive, and then cuts power to everything. The RAM is clear on reboot, but everything was closed down nicely.

I have a better understanding of solid state memory than hard drives, but hard drives act a lot like CDs and you already know, even if you dont necessarily understand that CDs dont lose their data when not powered. Solid state (Also called no volatile memory or NVM) storage what sits in an SSD, USD, or SD card, works with specially made transistors.

A transistor normally works because if you apply a voltage on the middle pin, it allows current to flow between the two outer pins. In more technical terms, the voltage at the collector is applied to the emitter, but only if the base is also powered. Waaaay long ago, they used a relay instead. The coil is literally a coil of wire that acts as an electromagnet, pulling two contacts together which allows current to flow through the contacts.

What can be done in transistors is isolate the base from the test of the circuitry. Normally, insulators don’t allow current to flow between two points. Air is a good insulator. But if the voltage is high enough, like between cloud and ground, the electrons will have enough energy to jump the gap and conduct. This happens on a nearly microscopic scale in modern NVM. The electrons jump the gap to the base and remain trapped there, permanently turning on the transistor. The state of the transistor is read by putting voltage at the collector and measuring whether it comes out of the emitter.

Clearing the memory cell works roughly in reverse, apply the opposite voltage, and let the electrons jump out. Very simplified, but enough for an ELI5 answer. The only thing I didn’t cover is the two main types of transistors are NPN and PNP. One of them turns on with a high voltage at the base and the other requires a low (or negative) voltage. Electrons being negatively charged require the latter to work in NVM.