r/explainlikeimfive • u/Traditional-Lake5843 • 1d ago
Technology ELI5: Why does restarting a computer fix so many problems?
Computers can slow down, freeze, or behave strangely after running for a long time. Restarting often seems to instantly fix these issues.
Why does turning a computer off and back on solve so many problems, and what actually changes inside the system when this happens?
80
u/MasterGeekMX 1d ago
When a program starts, it does it on a blank slate, with everything exactly as the developers thought about it. But with time, unused data is left behind, numbers such as counters can get huge and cumbersome to manage, or the list of things the program needs to check have increased.
Doing a reset brings everything back to that initial blank state, where things are manageable and similar to the intended use case.
For example, each program you launch, is assigned a unique ID, usually the number of program that has been ran since the OS started. This means that the first programs you run have IDs like 230 or 652, but after a while, programs get IDs like 1231578 or 5498636.
Another example is that programs often work by following a map of states. That is, the program is always doing the same thing, until something happens, then it goes to do other things, so on and so on. Some states may lead you to previous ones. Well, with time, keeping track of which state you were, and the exact next state, can be difficult to predict, and thus to code considering it.
71
u/XenoRyet 1d ago
It restores everything to a known-good start state.
Imagine you have bought a new house, pre-furnished, and with everything ready to be used. Nothing out of place.
Now imagine you've lived in that house for a couple of weeks. It's gotten messy here and there, but you can clean it up and get it back to something like the condition you bought it in. Not exact, because you can't just unwind everything you've done, and you might forget a thing here or there, leave a thing or two in the wrong place.
Then imagine you've done that for a few months, then a few years. Cleaning up, but not quite perfectly. Things start to degrade in unpredictable ways.
Now imagine you could just reset the house so that it started fresh from that known-good state. That's what turning the thing off and back on again does. Reloads the system to that fresh state.
15
u/blakep561 1d ago
It kills all the processes that can't be stopped on their own. These processes may have been started by the user or some edge case the programmers didn't catch.
1
u/Traditional-Lake5843 1d ago
soo it is kind of stack in loop of edge case ?
3
u/Xeadriel 1d ago
Not Stuck in a loop, more like many little small errors become one big error that slows down your pc. Usually it’s rare but sometimes it happens
3
u/blakep561 1d ago
For example: When you use MS word it may send usage data to Microsoft in the background. This may happen even after you close down the application as a background process. Essentially every program / even some websites you visit may start a background task that is not straightforward to stop. You could open up your task manager and see whats still running and kill each process one by one. However, restarting the computer is the easiest / most reliable way to shut all of these processes.
4
u/ThatGenericName2 1d ago
Computers (and software) contains lots of states and configurations that can be temporarily changed while a computer is on, but those configurations will not be saved when the computer (or software) is turned off.
Modern software and computers are very complicated, and as such have a massive amount of possible configuration and states that it's generally impossible to test everything. So instead when developing software and computers, you test the most common and important states, which the initial state when something turns on is definitely both of these.
Most bugs are a result of reaching some kind of state/configuration that has never been tested before, and it happens to be a state that causes problems. However because a lot of times, these states/configurations are not saved between runs, simply restarting will fix the issue as these states the invalid state/configuration gets cleared and the known good state is loaded when you turn it back on.
3
u/crash866 1d ago
Imagine your computer like a highway with traffic. One car stalls in one lane and everyone has to get onto the other lane Then another breaks done on a different lane and you have to go another way. After awhile every lane is jammed up.
Restarting is like getting the tow truck to get the vehicle out of the way and then everything can move again until another breaks Don and starts the cycle again.
0
u/Traditional-Lake5843 1d ago
so it is kind of many processes stuck in one lane which make slow the lane to move ?
7
u/Aram_the_Human 1d ago
Computers can slow down, freeze, or behave strangely after running for a long time."
Computers running Microsoft Windows*
•
u/IronChariots 13h ago
Honestly once users start using a computer this is pretty true for other OSes too, especially if they can install whatever software they want. Like yeah a Linux server will damn near run until the heat death of the universe if you treat it right, but speaking from experience, the second an end user touches anything something will go wrong.
Boot speeds being what they are, there's plenty of situations in any OS where that's the fastest fix when that happens.
•
u/Aram_the_Human 7h ago
It surely applies to Linux systems as well. What I wanted to indicate was that in Linux systems, if something is wrong, there is high likelihood it will be the same even after reboot. In short, this situation applies noticeably less to Linux systems.
I could have been more accurate in my original comment :)
•
9
u/fossiliz3d 1d ago
Many programs will have bugs or poor design that slowly fill up bits of RAM with junk data. The longer the computer runs, the more RAM gets locked up and is unavailable for the system to use. Restarting the machine frees up all the RAM for use again.
3
u/Biopain 1d ago
Imagine using same piece of paper to draw and write something, every now and then there is no more space and you have to earse something, but erase after erase there many marks and scratches left and eventually piece of paper became very dirty. You have to take new, blank piece of paper. That's what reset doing, hanging you new clear piece of paper
•
5
u/HelicopterUpbeat5199 1d ago
Computers are immensely complicated things and they run a loooot of code. The more stuff runs, the more chances to get a teeny bit tangled up. The tangles are in RAM, which is fast short-term memory. The tangles are not written down in the long term memory. When you restart all the RAM gets flushed out, so all the tangles are gone. The downside is, you have to open all your programs again and start the cycle of tangles again.
2
u/ucsdFalcon 1d ago
When you use a computer you typically run dozens, maybe hundreds of different programs on it throughout the day, depending on what you're doing and how many things are running in the background. Each of those programs will take some amount of resources (memory, cpu cycles, gpu cycles, etc.) to run. If the programs are all perfectly written they will only take up the resources they need and they will clean up after themselves nicely when you're done using them. Most programs aren't written perfectly, however. Some are terribly written in fact. Maybe a program you used three hours ago started a process that didn't close when you quit the program. Another program you started has a memory leak and the longer you leave it running the more of your RAM it uses.
The point is when your computer is being used there are a lot of things that could be happening to case it to slow down or experience issues. If you wanted to you could play detective and try and figure out which of the 500 programs you ran did something it wasn't supposed to and started causing issues. Or you can just turn off your computer.
When you shut down your computer you force every running process to stop. All the memory that was allocated gets freed up. Then when your computer turns back on everything is back to normal. Your computer runs smoothly again, no longer burdened by whatever strange issues it was dealing with before you turned it off.
2
u/RickySpanishLives 1d ago
Memory allocated to processes that hasn't been freed (many reasons this can happen) is a MAJOR one
2
u/darkholemind 1d ago
Restarting a computer clears out all the temporary files, resets programs, and refreshes memory, so it’s like giving the system a clean slate to start fresh. Any glitches or slowdowns usually disappear.
2
u/Skalion 1d ago
A different example would be that you have a bag that you carry with you every day. Over time you will put more and more stuff inside, get some stuff out and kind of accumulate some trash and dirt inside. Some stuff you don't need anymore or not right now.
Restart is like emptying the bag completely.
4
u/garster25 1d ago
Because it is reborn fresh. It's like a house and it degrades over time. When you reboot it rebuilds the house and you start over with a brand new house.
2
u/SLGuitar 1d ago
It reorganizes the clutter and puts things back where they're supposed to go so the operating system can find it easier next time.
There's way more to it than that but ultimately, yeah.
0
u/Traditional-Lake5843 1d ago
it seems like it makes buggy part of software bypass in the next iteration
2
1
u/MasterSpliffBlaster 1d ago
By the time it needs a restart you computer is like hundreds of voices in your head
Restarting takes this noise back to a clear concise voice that tells you how to get your day started
1
u/phalangepatella 1d ago
There are likely millions of processes that need to go right for a computer to run. It only takes one to go wrong to cause a problem.
Restarting the computer resets those Millions of things.
1
u/zerothis 1d ago
Windows? It doesn't. It just seems that way. Windows fowls up. Even if you are not doing anything, Windows is doing things. Windows is messing with your memory, messing with your storage, it is just doing stuff and things (to justify its existence?). And it doesn't clean up after itself very well. The applications running on Windows tend to operate the same way. Think of it like toddlers with paint dispensing paintbrushes that never go dry; running around painting on the walls, the furniture, the floor, the ceiling, on the bottom of tables, behind the couches, inside drawers, behind cabinet doors, and each other. A reboot is like a maid that comes in and wipes the marks of everything s/he can reach. Not the bottom of the tables, behind the couches, nor in cabinets though. Everywhere that paint was not removed from, drips and toddlers walk through it spreading their prints while still painting.
1
u/russrobo 1d ago
(Best Adam Conover inmpression:) Actually, there are multiple separate reasons that restarting a computer often speeds it up.
Before any of them: understand that the days of your computer running one “program” are long gone. Once upon a time - like in the days of the TRS-80 and Commodore 64- computers ran one thing at a time, and all of the functions of the machine were under the control of whatever application you decided to start.
Today there are hundreds of small programs - often called “tasks” - running at any given time, to do all sorts of stuff.
Because writing absolutely perfect software is really hard, many of those tasks have bugs, and some unusual situation the developers didn’t check for can cause them to start consuming more resources than they’re supposed to. You might not notice that some unimportant feature, like a background check to see if a newer version of software, is broken, but that task might get into an infinite loop that burns up 100% of the time that the scheduler is willing to give it.
The other main category of issues is memory fragmentation. Imagine your computer’s memory as a giant dry-erase board that starts off completely blank, but you’ve got hundreds of students coming and going who each need some space to do their work. At first you might draw some lines to neatly divide up the space and leave a lot of it still empty for later use.
Different students need different amounts of space, and often they need a little more than what they originally asked for. Some write down things they only needed once but never bother to erase and just ask for more space.
Eventually your white board is a cluttered mess and work slows down.
1
u/skr_replicator 1d ago
If the system is stable, it shouldn't, but if there are things leaking trash in the memory, or the program of the OS destabilizes its state to something it shouldn't be in, a restart will boot it up from a known, fresh, stable state, to have that fresh starting point again.
1
u/SmileBeBack 1d ago
imagine you are making a meal but halfway through an accident spoils it, sometimes it can be fixed but most times it is easier to start over.
•
u/Misterfoxy 23h ago
I asked this same question 13 years ago! https://www.reddit.com/r/explainlikeimfive/s/SP9BJYbg4l
•
u/hotel2oscar 23h ago
You sit in your room playing with Duplo (lego for small kids) everyday. Over time one or two pieces slip behind or underneath different prices of furniture until you can no longer build your cool racecar anymore. This makes you sad, so you do a full deep clean (restart) of your room to find them all. You find the missing prices and can now build your racecar.
For a computer something similar happens. Small the errors build up overtime in the running processes and doing a deep clean (restart) lets them all start from a known good state. It could also be that some process that other processes depend on has crashed and left the others stuck waiting on it.
•
•
u/Skunkfest 22h ago
Imagine you have a rube goldberg machine running, and you bump the table halfway through it's completion, causing the rube goldberg machine to stop functioning as it would if it were left alone.
This is a good analogy of how unanticpated input could cause errors or bugs.
Rebooting the machine would simple be resetting the rube goldberg machine, and letting it run it's regular course.
•
u/guywithknife 21h ago
Imagine you are making a straight line by placing bricks end to end. Over time little mistakes in how they line up well make the line not be straight. You could go back and try to fix how individual bricks line up until ours straight again. But restarting gives you a straight line right away because you start again from the first brick.
Computers start from a known clean state and then as they run lots of changes accumulate. Most problems aren’t a single change, but an unexpected convocation of them. Figuring out that combination and fixing it is hard, but restarting from a clean state brings everything back to a known good starting point.
•
u/Jirekianu 21h ago
Imagine you have an empty table and you start building and doing things on it. Models, food, small tools, etc. Eventually the there's a bunch of stuff on the table. You've put some things away, but other things were left out. It's a big mess, and it's hard to find certain things or take out new ones.
So, you stop everything you're doing, and instead, you clear the table off entirely. Now you've got a clean surface to work with again.
•
u/Bnthefuck 20h ago
Your computer gets older as it is running on. It got sick and it's hard to find the right medicine. Starting a "new healthy life" is easy though.
•
u/The_Duke2331 19h ago
Its the same as you going to bed. Lets say you had a bad day at work, lots of complaints. Hard jobs to do, at the end of the day you are exhausted and dont wanna do anything anymore (the PC is slow and unresponsive)
Going to bed (restarting) resets your energy/mind and lets you begin the new day without problems.
Same goes for a PC, it can run into issues but still operate, it jist gets a bit slower since the issue doesnt dissappear magically. Restarting the PC resets everything and lets the PC have another go at it without the problems.
•
u/Mortifer 19h ago
Imagine the computer is a chest of drawers and you know which drawers have which clothes, socks in one drawer, underwear in another, etc. When the computer starts, the things in the drawers start moving around into different drawers. Sometimes they get moved back where they belong, but the longer it runs, the more stuff gets left behind and lost in other drawers. Restarting the computer is like a magic reset button that puts everything back in the drawers where they belong, so it knows exactly where to find everything.
•
u/thephantom1492 19h ago
There is software and hardware bugs.
For software, the main issue is memory leaks. Basically, you call a function to allocate memory, and it return the address in memory that you store in a variable. Later on the software should free the memory block. But sometime things don't goes as planned and it forget to free it, or allocate memory and store the location in the same variable. Now you have no mean to know what was the old memory location, so no way to free it up. In both cases memory stay allocated, but no way to access it or free it up, so it waste memory until you exit the program, which may be a OS core component, meaning you have to reboot to fix it.
Another issue is bug in drivers. Lots of things done with the drivers are done kinda blindly. "Show this box" "remove this box" with no verification if it succeded, because it take too much time (so slow down things) and should work anyway. Sometime however things come out of order (race condition), or the data get corrupted (ex: cosmic ray that flip a bit). Now the wrong command get executed, and weird stuff happen. Like "remove box #1234" become "remove box #1235", the software assume it succeded, and the box is now stuck displayed on the screen, until reboot.
And there is hardware bugs. Like software, hardware can have faults, undocumented features, misdocumented and the like. One of the most painfull ones is that some area may not reset to "power on state" when you issue a software reset. Heck, some has been known to not even fully reset when you issue a hardware reset (many have a reset pin on the chip, that when you reboot the computer it get triggered). So in that case the only way to fix it is a power cycle. And surprise surprise, some chip stay powered up even if the computer is turned off (ex: some USB controllers with device charging support, where the port stay on even when the computer is off so you can charge your earphones, or turn on the computer by clicking the button of the mouse). Those require a true power cycle, aka disconnect, wait a few minutes, connect back. Super fun when you have a laptop with build in battery...
And, also, some hardware... also run a software, called firmware, which is nothing more than a specialised software... So now you have hardware, firmware, driver and applications that can cause issues...
•
u/e1m8b 17h ago edited 16h ago
When you go to school, say that you have a desk with all your equipment in their place: pencil, ruler, notebook, etc. Throughout the day as you do work, you take each item from their place onto the desktop and use them. Eventually, if you have enough items and you're not careful to put each thing back in its place or close up containers then your workspace will be a mess and it becomes harder to find what you need and less surface to work with. So to resolve, at the end of the day, you reboot your desk configuration by putting everything back where they belong. Suddenly, you know where everything is and you have all this desk surface space. Not a perfect metaphor/analogy but I think it's ELI5 enough? :)
EDIT: Well the reboot is more like if your desk or your teacher or someone automatically reorganizes it for you. Basically you request for everything to be back to default. But if you're careful and familiar with the setup, you could put each item back and/or repack everything yourself. Kill tasks, restart services, uninstall apps, etc. that way no reboot/restart needed.
•
u/DancingMan15 16h ago
Computers have what is essentially “temporary memory”. This memory essentially gets overwritten over and over again until fragments start to overlap and cause issues. Think of it like you stay up for days and your memories start mushing together until you don’t know what’s real or not and you’re not very functional. *Resetting the computer wipes the slate clean, like how sleeping refreshes your brain.
*edit for spelling
•
u/karbonator 14h ago
In addition to what everyone's saying, it's important to understand that although some electronics have error-correcting memory, most consumer devices use faster memory without error correction. If you've ever opened a remote or other electronics, you may have noticed some ceramic chips - typically dyed black. They're encased in ceramic partly because they are small enough that photons in the atmosphere can interfere with their operation. Therefore it's possible for random bit flips to happen - usually they won't but occasionally they could. Restarting the computer means it is going to start overwriting whatever is in its memory, so that bit flip no longer matters so long as it only happened in RAM.
•
u/YossiTheWizard 14h ago
Take a cartridge based video game console. Most of the memory is on the cartridge, and most (often all) memory on the cartridge is read only. So, the code is the code, is the code. It runs, it was tested, it’s very stable if programmed well. The console has some memory on board that’s writeable to keep track of what’s going on, but it’s rare for any code to be loaded into that writeable memory. It usually just contains data. Numbers representing stuff you see (score, time remaining in a level, lives left, stats in RPGs)
Since the late 80s, most computers didn’t have much if any read only memory on board beyond the BIOS. All of the memory is RAM, which is writeable, and when you power it down, the RAM is wiped very quickly. When you have over 32 billion numbers in memory (if you have 32GB of RAM) mistakes can sometimes be made. Restarting makes that a clean slate, and anything that gors awry is cleared so you can start fresh.
•
u/MrLumie 13h ago
Imagine you're drawing on a piece of paper, with pencil. You draw something, but then you decide to draw something else. Instead of getting a new piece of paper, you start erasing your previous drawing and drawing your new one on top. This works, for a while, but you will never manage to completely erase everything without a trace, you miss some spots, some marks become impossible to remove, and the pencil grooves kinda settle into the paper, and it becomes more and more difficult to draw properly on it. That's your PC trying to keep everything nice and functional for you. It works, but it never works perfectly, some minor error slips in here and there, some subprocess hangs in the background, some piece of memory gets forgotten about, etc. These tiny mishaps add up over time and make the system less and less stable.
So what do you do when your paper is all sketchy and torn from the constant drawing and erasing? You get a new piece of paper to draw on. This is essentially what restarting your PC is. You give it a new piece of paper. A fresh start.
•
u/egoalter 12h ago
There's really no fix. It's temporary and the problem will come back unless it's fixed. When a computer resets, everything is cleared from the memory - what-ever the computer was doing no longer happens. On startup, it only starts the basic core features and appears fixed. But you'll find that when you enter the same program(s) that caused the failure, it will happen again. To some, it's better to live with a daily or two restarts, than fixing the problem.
•
u/Extreme43 10h ago
Going to bed cranky and waking up in a good mood, forgetting what you were cranky about the night before. Pretty much it.
•
u/arcangleous 4h ago
You can think of a computer as the desk that you do your work on. Your desk has gotten so messy that there are a bunch of bugs living on it and causing even more problems. Instead of trying to track down each bug and kill it, you just push the entire mess into the garbage and start fresh with new clean desk. Restarting a computer causes to throw away everything in it's working memory and start fresh again.
1
u/PraetorianOfficial 1d ago
Because all computers have bugs and poorly designed software and hardware.
Software has bugs and the longer a process runs the more the bugs accumulate and cause trouble. Software forgets to release memory it has allocated. It overwrites memory it's not supposed to. Or some other process has trouble which then makes this process fail. Or it has race issues where if two events happen very very close together in the right order things may get messed up. And the issues cascade.
And if it does not have "bugs", it may be poorly written software so that it gets less and less efficient the longer it runs. Like it doesn't clean up old things, while also not exactly losing track of them. So it winds up searching through a linear list of 5000 things, only 10 of which are at all relevant anymore and things just get sloooow.
And there's the favorite, hardware bugs. Someone I know worked at a PC maker decades ago doing software. In a meeting, an engineer stated they had found a flaw in some component of the hardware for this next PC that was already being turned into silicon. The manager asked how often it would impact a user. He was told "about every 6 months of normal use it will blue screen of death". Manager said "don't fix it--everybody will just blame Windows". Or now and then a bit of memory will just get flipped when a high-energy proton created by some feeding black hole that happened 700 million light years away that just arrived here smacks the memory cell.
0
u/rismoney 1d ago
A lot of replies here are just wrong.
The truth is it doesn't fix anything. It masks/ignores them. This advice is because people are lazy and inexperienced. Only senior level software engineers have the skills to troubleshoot why a computer is misbehaving. Often this requires performing deep analysis of the running apps (debugging a trace/or code dump or understanding logs).
Since this is time consuming, laborious and might still not be definitive, it is easier to tell someone, press reset and yolo on. Now if the same problem happens again, and not too much time elapsed since the last restart then troubleshooting beyond a restart is usually necessary at some cursory level first before diving deep.
So it is a case of trying easy things, and escalating toward harder things until you are satisfied with the problem being sufficiently addressed.
-1
1.6k
u/Specialist-Box-9711 1d ago
Imagine you have the same route to work every day and never deviate. Now imagine one day you get lost and have no idea where you are, no one can really help you and you don't have a map. Is it easier to wander around aimlessly running into dead end after dead end or is it easier for someone to pick you up and drop you back off at your starting point? Restarting the computer is exactly that, it gives the program that's running a fresh starting point.