eli5: How does “restart” work? when a device, e.g. windows PC is turned off, how does in know to turn itself back on?

226 views

Edit: Typo in title🤦‍♀️

How does it* know to turn itself back on?

In: 114

10 Answers

Anonymous 0 Comments

In older PCs and similar devices, there was a physical power switch. You’d flip it or press it and it would break the physical connection between the wall current and the power supply for the device.

In more modern systems there are circuits that wait for a small signal, like the voltage generated by a button being pressed. When they detect it, they’ll send another signal into the control circuitry of the device to either flip a physical relay (you’ll hear a “click” sound in these ones) or to cause other solid-state circuitry that carries much higher currents to be enabled and send power to the main device.

When a computer is first powered on its memory, registers (tiny bits of memory used to work on something directly) and other devices are usually in a random state, so in order to clear that up, initialize the system and put all the pieces in place- set the stage, essentially- the system must “bootstrap” itself, meaning it has to lift itself by its own boot straps. That’s since become shortened to “boot”.

When a system boots up, there will be some hard-coded instructions somewhere in the form of read-only-memory, that can’t be altered. The CPU is physically wired to start at a specific, hard-wired set of instructions. Those instructions are extremely basic, and do very little except tell the computer how to start, and usually to load the “Basic Input/Output System” (aka BIOS), which is also stored in non-volatile, but modifiable if you have the right tools, memory.

The BIOS then takes over and starts the process of initializing devices that the CPU hasn’t yet (keyboard, mouse, hard drive interfaces, USB bus, etc) and then starts the process of loading the actual operating system- Windows, MacOS, Linux, whatever.

Other devices that rely on microprocessors will all work in a similar way, and while they may use slightly different processes or call things by different names, do them in different order, it’s all variations on a theme.

Anonymous 0 Comments

Each computer has a sort of program (called bootstrap) that starts a sequence of instructions which identify and initialize all components of a PC such as the CPU, Motherboard, RAM, etc.

Anonymous 0 Comments

[removed]

Anonymous 0 Comments

Something something CMOS battery something something, right?

Anonymous 0 Comments

When your computer shuts down, it first does a whole cleanup process involving closing all programs, shutting down the network connection, clearing cached disc writes, disconnecting from peripherals, etc. Then, it sends a signal to cut power to the system.

For a restart, it basically does the same thing, except instead of cutting power, it sends a signal to reset the system. This “reset” essentially tells the motherboard to reset all of the components on it such as the CPU and RAM (which generally involves triggering certain pins on these components), and then act like it was just turned on. **But the motherboard itself never loses power in this process.**

Anonymous 0 Comments

Your system has a lot of different power states. They are managed by ACPI (Advanced Configuration and Power Interface) sitting on the motherboard.

Now when the operating system wants to reboot, it sends a command to that ACPI thingy to do so. The system goes down and ACPI turns it back on.

Stuff like power buttons on keyboards trigger similar ACPI stuff to work.

Anonymous 0 Comments

Restart doesn’t fully turn the computer off, it just triggers a routine that resets everything as if it was turned off. So parts of the computer are still technically “on” during the entirety of a Restart.

Anonymous 0 Comments

There is a layer called [ACPI](https://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface#Power_states) which is how the software running on the computer talks to the hardware about many things including power states. So using that, the Operating system tells the motherboard that it wants it to do a restart in much the same way it tells it to do the shutdown. Also in a restart while most everything is reset as if it was switched off and on again, power isn’t just cut off (at least not to the bit of hardware that is responsible for power management)

Anonymous 0 Comments

Every PC has a BIOS, which basically handles a load of the super basic stuff. Think of it like the instructions that tell you how to open a box. From there the BIOS boots the OS by mounting the boot partition. Think of it like the opened box having a little delivery robot will then fetch all the necessary materials for your task.

Anonymous 0 Comments

A computer processor loads an instruction from memory, executes it, then advances to the next instruction in memory, executing it too, and so on. Each advance increases by 1 the number stored in something called the instruction pointer; this is how the processor knows where the next instruction lives.

Most if not all CPUs have a single “RESET” pin that has one function — it sets the instruction-reading “pointer” to a hard-coded location. This hard-coded location is where a computers boot-up routines live, so the computer carries on booting up as if it was just turned on.

Fun fact: Notice how the memory isn’t explicitly cleared? This is why, very rarely, a complete cold off and power on solves a problem rather than a software reset. Used to see a lot of this with old bargain bin wifi chips that were installed into laptops; they’d bug out and you could only fix them by going cold off.