Why does ‘turn it off and turn it on again’ work most of the time?


Why does ‘turn it off and turn it on again’ work most of the time?

In: Other

Computers and most electronic devices end up storing temporary data throughout their normal use. Your copy/paste clipboard, your open programs, all your browser tabs, even the graphics are all temporary. The device would need to recalculate or look up that data again if you wanted to access it after restarting. When your device starts to fill up on that temporary storage, or some of that data gets corrupted, it can start to cause issues. Restarting your electronic device gives it a chance to empty out that full storage or dump the bad data. Then it starts collecting just like normal.

For servers that can’t be shut off, their operating systems and programs take /a lot/ of extra steps to avoid those issues, so it’s easier for non IT people to just restart regularly.

Lots of software bugs have to do with memory management, where there’s a difference between what the software expects will be in RAM and what actually is there. This can happen for all sorts of reasons, most of which boil down to the humans who wrote it made some assumptions that are true most but not quite all of the time. The longer a piece of software is running the more chances there are for one of those assumptions to be wrong, and once it has gotten out of sync it usually doesn’t have the ability to notice, let alone fix the problem.

Restarting the machine forces all the software on that machine to set the memory it’s going to use up again from scratch, which usually means that it’ll be in state where the expected and actual state of that memory match again.

All computer and electronics are based on the Turing machine. It’s state is most predictable in its starting state, the farther away you are from the starting state, the less predictable the behavior is. Restarting just returns the system to it’s starting state.

Think about a pool of water.
Now for some reason someone dropped red color into this pool.

Now if you try to get water from this pool it will always be red no matter what you try.


No if you empty the pool and refill it with fresh water you can get rid of the color.


This is (ELI5) what happens if you restart you computer or many other machines. Some data is for some reason in state it should not be and you either have no idea where or how to change it back.

So the restart will flush out all data and refill it with the now (hopefully) correct one.

**Please read this entire message**

Your submission has been removed for the following reason(s):

* ELI5 requires that you *search the ELI5 subreddit for your topic before posting*.
Users will often either find a thread that meets their needs or find that their question might qualify for an exception to rule 7.
Please see this [wiki entry](http://www.reddit.com/r/explainlikeimfive/wiki/how_to_search) for more details (Rule 7).

If you would like this removal reviewed, please read the [detailed rules](https://www.reddit.com/r/explainlikeimfive/wiki/detailed_rules) first. **If you believe this submission was removed erroneously**, please [use this form](https://old.reddit.com/message/compose?to=%2Fr%2Fexplainlikeimfive&subject=Please%20review%20my%20thread?&message=Link:%20https://www.reddit.com/r/explainlikeimfive/comments/o66yrj/eli5_why_does_turn_it_off_and_turn_it_on_again/Please%20answer%20the%20following%203%20questions:1.%20The%20concept%20I%20want%20explained:2.%20Link%20to%20the%20search%20you%20did%20to%20look%20for%20past%20posts%20on%20the%20ELI5%20subreddit:3.%20How%20is%20this%20post%20unique🙂 and we will review your submission.

People talk about software only, and that part is not true anymore on computers with modern operating systems.

Modern systems basically provide software with resources that get extremely monitored. For example a program is going to ask some memory space, but if by mistake it tries to write outside of it, the operating system will terminate it without getting in trouble.

Someone gave the example of a pool, but this is not how it works anymore, and the “liquid” part is wrong too. So imagine a pool filled with a very easy to cut solid.

Programs are basically buckets that ask the operating system to fill them with various resources(ram, cpu, access to hardware) . The OS takes said resources from the pool and puts it in the bucket. It monitors everything. If the programs tries to access a resource it was not allocated, it will be stopped by the OS. The OS abstracts everything: a program may believe it is writing at a specific address, but it is not; the OS intercepts it, checks everything, then map it to the real address, which is different.

If the program does something forbidden, like writing outside its allocated ram or reading a register from a hardware that it is not supposed to have access to , the OS terminates it, empties the bucket outside, then puts back as much fresh solid in the pool as there was in the bucket, in the same shape it put in the bucket.

The next problem has become memory fragmentation, but this too has been a bit solved.

After some time, you have tons and tons of buckets of various sizes in use, and many programs have been terminated, either by the OS or they did their job and were stopped.

Since the OS returned resource in the shape it allocated them to buckets, you now have tons and tons of small bucket shaped stuff in your pool, and the OS cannot allocate multiple small buckets to fill a big bucket. So there still are resources available,but you cant use them. This is memory fragmentation.

So periodically, the OS will take small bucket shapes and fit them together again as one block it can cut from. On windows it started to work well with windows 7, and works very well with 10. So there really is not more need for a software reset, as long as this works… and as long as there are not gazillions of programs slowly reserving all the resources.

The problem switched from being caused by improper OS protection to improper usage from the user. Resetting the device at this point kills the prgrams, and the OS gets back all the resources.

But this is only a software reset case, not a turn it off and on again case.

Turn it off and on again means going hardware. Chips have bugs, just like software. They can start doing stupid stuff and need to be power cycled so capacitors get emptied, for example.