1

I have 8GB RAM with and it have variables and stuff. I close the computer and most of the data on the RAM is no longer there.

If the normal hard drive make files on overwriting mode when they get deleted what happens with RAM when I shutdown my computer does they just disappear to the air? Or what?

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
  • 3
    https://superuser.com/help/dont-ask states _You should only ask practical, answerable questions based on actual problems that you face. Chatty, open-ended questions diminish the usefulness of our site and push other questions off the front page._ – K7AAY May 19 '20 at 23:48
  • 1
    I would argue that he actually has a practical, answerable question. My interpretation of his question is `what happens to the content of RAM when the computer loses power'. The question is a bit poorly worded though. – Quazi Irfan May 20 '20 at 00:09

2 Answers2

4

It is for the same reason that when you remove power from an LCD screen that it will go black. The same as a light bulb and millions of other electrical devices. Because in order to do work such as providing light or movement or storing data they require a constant flow of electricity.

Once that flow is interrupted then the process that does the work will stop and the state that was being maintained by the electric current will stop as well.

The state of a bit of RAM requires constant application of electrical energy to retain state, otherwise that state is lost. The devices are said to be "volatile". This is a feature of fast switching electronic devices.

But you say that hard drives do not loose data when power is removed. Hard drives, SSDs and the like require power to change the state of bits of data. Left without power the data will not change. This is due to the way the data is stored.

In hard drives the work is done by forcing the magnetic field in an material to flip direction, in much the same way as you can magnetise a needle by rubbing it with one end of a magnet. The needle will have a magnetic field that is aligned depending on which end of the magnet you used. You can remagnetise a needle using the other side of a magnet and it will flip the direction of the magnetic field. This change in magnetic field is, for all intents and purposes, permanent until work is done to change it.

This change in magnetic field is a change to the fundamental material and is a feature of how we store data on "non-volatile" media like hard disks. SSDs work differently. By trapping electrons in an area of circuitry they store bits of data but it still requires work to make a physical change to the value of the data.

The difference between the two is that one method of storing data uses power to hold the data, the other uses power to force a physical change in a material.

But these two methods have different benefits. Using power to hold data in volatile devices allows those devices to be changed much more quickly, up to millions or billions of times a second, while non-volatile devices are far slower due to the physical nature of the changes that happen.

Mokubai
  • 89,133
  • 25
  • 207
  • 233
  • 1
    This answer is good at the 101 type level. Its worth pointing out that the contents of RAM, when not refreshed/powered on, degrade over time (in range of seconds), and generally faster at higher temps. This is important to be aware of because of cold boot attacks. Likewise SSDs do decay and loose data at a very slow rate (typically years), but fast enough they are not a great idea for long term storage. (This ssd one is controversial) – davidgo May 20 '20 at 10:03
  • @davidgo I specifically wanted to avoid going into too much detail such as the fact that SSDs do degrade over time and RAM is being constantly refreshed. There are too many caveats and it seemed that the question was based on a false premise that they functioned in a similar way when they are fundamentally different ways of operating. SSDs are one of those border cases. They are appreciably fast, and non-volatile, but the act of writing and (in particular) erasing is actively destructive and not suitable for a lot of use cases where volatility is acceptable an acceptable trade for longevity. – Mokubai May 20 '20 at 12:58
  • 1
    You conflate RAM with its implementation using DRAM. Yet you distinguish between mass storage implementations using HDD and SSD. Volatility and refresh are characteristics of ***dynamic*** RAM. RAM does not have be always implemented with DRAM. Ferrite core and static RAM have also been widely used for the main memory (aka RAM) of computers. – sawdust May 20 '20 at 18:10
  • @sawdust Correct. Static RAM is volatile, just quite as volatile as dynamic RAM - needs power but doesn't need refresh. More importantly, AIUI, core memory was essentially non-volatile. – manassehkatz-Moving 2 Codidact Nov 27 '20 at 02:03
1

Ok, let's start from the basics. RAM stands for Random Access Memory and it is volatile. When you shut down your computer, RAM clears out and there is no data stored in it.

If your operating system is Windows, then there are two modes that are related to this. One is Hibernate mode and the other is Sleep mode. When your computer is sleeping, it is still on and everything you have open is stored in RAM. When your computer is hibernating, everything is stored on your Hard Disk.

If you would like more information, then please edit your question to be more specific and worded better.

Todd
  • 331
  • 1
  • 2
  • 11
  • When you shut down it goes to the hard drive. – Moab May 20 '20 at 00:22
  • every time i open and close pc? it goes to the hard drive? – soldier captain May 20 '20 at 00:28
  • 2
    *"RAM stands for Random Access Memory and it is volatile"* -- RAM is volatile in modern computers only because RAM is implemented with (semiconductor) ***dynamic*** RAM. Back in the day (i.e. pre-1980s) computers used ferrite core RAM, and that was not volatile memory. Volatility is not an intrinsic characteristic of RAM. – sawdust May 20 '20 at 00:28
  • 1
    @Moab All the contents of RAM are stored on the hard drive when it shuts down? That’s news to me! I mean some systems save RAM and system state in a file when the system goes to sleep — or hibernates — but the question doesn’t state that. – Giacomo1968 May 20 '20 at 00:29
  • "turn off" is subjective term. But a shift/shutdown command in W10 purges memory to hard disk. Since they did not state the OS or the method of shutdown the answer varies. – Moab May 20 '20 at 00:46