There are a lot of things computers do that, in usage, seem very simple. Under the hood, though, there are a lot of parts that work together to enable basic behavior. One example is rebooting a computer. Reboot is conceptually very simple, it turns off and then turns back on again. In today’s Question of the Week, Seth Carnegie wondered how this actually happens:
This may be a really stupid question, but how can a computer restart itself? After it’s off, how does it tell itself to come back on again? What kind of software is it that can do this?
They say there are no stupid questions, only stupid people. Seth certainly isn’t a stupid person, this is actually a very interesting question. The action of turning a computer on and off seems very simple, and at one point it was: there was just a simple hard power switch between the power supply and the wall. Today, in the interest of both power saving and convenience, computers are able to turn themselves on and off quite flexibly (for example, most BIOS allow you to set a time of day that the computer should turn on automatically, and most network cards can turn on the computer when they receive a special packet). Clearly there is some kind of software running that controls how computers turn on and off.
I have a bit of background in robotics (FRC Team 1432!), and I’ve used computer power supplies as bench supplies for testing. Because of this, I’m familiar with the ATX pinout and knew about the PS_ON and PS_RDY pins that allow basic communication between the PSU and the motherboard. Interestingly, it turned out I remembered both of these wrong: PS_ON should be connected to common to turn on the power supply, not to +5vsb, and the “ready” pin is virtually always labeled “PWR_OK,” not “PS_RDY.”
I was also familiar with the term Advanced Control and Power Interface (ACPI) and the ACPI power states, but I didn’t know a lot about how ACPI actually works. From Wikipedia, I got a list of the ACPI power states and their meanings, but noticed that Reboot was not just a power state that could be set. A little artful googling turned up a website with the ACPI specification documents. These documents explain the ACPI reboot process in full: a register included specifically for ACPI control is set to a specific value to indicate that the machine should reboot. ACPI actively monitors this register, and as soon as it reads the correct value it resets all components and runs a cold boot.
Interestingly, neither the address of this register nor the value that should be written to it appear to be standardized. Instead, there is a standardized location that both values can be read from. This is probably to allow motherboard manufacturers as much flexibility as possible in using address space.
I think rebooting is an interesting example of how complex computers really are: deep down inside, a many parts designed by many people send a series of electrical pulses back and forth to trigger the behavior that we see and use. It’s cool to think about it all!