Why restarting the computer is the solution to (almost) all problems
When we are stuck with a problem, a usual strategy is to start over from scratch. Redoing the problem from the beginning allows us to avoid possible previous errors that may have gone unnoticed and have a better perspective of how and why the problem occurs.
In the field of technology, this strategy also applies.
Is your computer going slow or does it not respond? Try restarting the computer.
Doesn’t work the program? Kill it and run it again.
Let’s talk about why restarting the computer is such an effective solution.
First, a computer has two different types of memory:
- Non-volatile memory allows you to store data in the long term even when you turn off the computer. As a disadvantage, this type of memory is (comparatively) slow. Some examples can be a hard disk, an optical disc (CD, DVD or Bluray) or a USB stick.
- Volatile memory is very fast but it requires energy continuously to maintain its contents. Because of its speed, volatile memory is used as the working memory of the computer.
This working memory is managed by the operating system, which controls which processes are running and allocates a space to each process. Each process stores in this space the data it is manipulating at this moment and requests resources from the operating system (such as more memory, access to the CPU or access to a peripheral) that it must release when it no longer needs them.
A program can have programming errors that cause the computer to behave in an unstable way:
- For example, a programming error can cause a program to enter an infinite loop, consuming CPU without doing anything and slowing down the rest of the processes.
- Other programming errors focus on an inadequate use of resources: a process requests a large amount of resources, or is making small requests over time but without releasing resources previously obtained. The final result is that the rest of the processes have few available resources and must wait until they are free. In particular, memory management can be a problematic area. In addition to hoarding memory without releasing it, a process may try to access memory that either had not requested or had previously released. This erroneous access can modify the data of the process in an unexpected way or, in more extreme cases, modify the data of other processes or the binary code of some process.
- The operating system can also have its own defects that cause resources to be permanently blocked without being used or processes that end their execution but still occupy resources.
The reboot of a computer is a way to repair the working memory “in a forced way”: eliminating it and starting from scratch. Using this method, it is not necessary to worry about the cause of the problem: we return to a “correct” state of the working memory and, if the same circumstances that led to the error do not happen again, they will not happen again.
Thus, restarting a computer is so effective for three reasons:
- Because it serves to solve different types of problems at the same time: accumulation of resources, zombie processes, programs that have entered infinite loop, corruption of memory, etc.
- Because we do not need to spend time diagnosing the cause of the problem.
- Because if the error appeared due to a combination of unusual circumstances, it will generally not occur again and it will appear that we have “fixed” the problem.
However, it must be borne in mind that restarting is not a solution to all problems. For example, it does not solve hardware problems or eliminate malware (if it exists). And it will not solve the error if our computer is not powerful enough, either because we run too many programs when starting the computer or because the program we want to use needs more resources than we have.