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?

  • 8
    @jer.salamon: They're actually completely different paths. Shutting down invokes a ACPI routine which sends a signal to the ATX power supply which turns off the main voltage rails. Commented Jul 28, 2010 at 21:08
  • 13
    This is controlled through the BIOS -- if memory serves, keywords of interest are APM and APIC
    – pst
    Commented Jun 8, 2011 at 19:05
  • 122
    It never really turns "off" on a restart.
    – Moab
    Commented Jun 8, 2011 at 19:15
  • 10
    There are no stupid questions. No, there maybe are -- but I think this one's actually very interesting. Featured as a question of the week candidate.
    – slhck
    Commented Jun 8, 2011 at 20:01
  • 4
    I used to telework on a remote server which was basically just a PC without screen or keyboard in the company's datacentre. My server was never normally turned off at all, but sometimes I'd reboot it from my end using WinXP Start->TurnOffComputer->Restart, to sort out instabilities caused by testing my own code. I'd often work at times of my own choosing, when the datacentre was unmanned. It was very tiresome what I accidentally selected Turn Off as the final option, and had to wait until two days later for an operator to go and press the on switch for me! Commented Jun 8, 2011 at 23:00

7 Answers 7


tl;dr: power states in your computer are controlled by an implementation of ACPI (Advanced Configuration and Power Interface). At the end of a shutdown process, your operating system sets an ACPI command indicating that the computer should reboot. In response, the motherboard resets all components using their respective reset commands or lines, and then follows the bootstrap process. The motherboard never actually turns off, it only resets various components and then behaves as if the power button has just been pressed.

Long and rambling but (in my opinion) more interesting answer:

Soft Power and how it works

In the olden days (well, okay, to a college student like me the '90s was a long time ago), we had AT (Advanced Technology) motherboards with AT power management. The AT power system was very, very simple. The power button on your computer was a hardware toggle (probably in the back of the case) and your 120vac input went right through it. It physically turned the power to your power supply on and off, and when this switch was in the Off position everything in your computer was completely dead (this made the CMOS battery very important, because without it there was no power supply to keep the hardware clock ticking). Because the power switch was a physical mechanism, there was no software way to turn power on and off. Windows would show the famous "It is now safe to turn off your computer" message because, although everything was parked and ready to turn off, it was not possible for the OS to actually flip the power switch. This configuration was sometimes referred to as hard power, because it's all hardware.

Nowadays things are different, because of the wonders of ATX motherboards and ATX power (that's Advanced Technology eXtended if you're keeping track). Along with a number of other advances (mini-DIN PS/2, anyone?), ATX brought soft power. Soft power means that power to the computer can be controlled by software. This brought a few import changes:

  • Standby power: you may have seen a "5v SB" or "5v standby" connector labeled in power supply pinouts. The standby power supply is a 5v line to your motherboard that is always on, even when the computer is turned off. This is why it is important to unplug or turn off a PSU hard switch (if present) when servicing modern computers, because even when it's off you could potentially short the 5v SB and damage the motherboard. This is also why CMOS batteries aren't really as important anymore - the 5v SB is used to replace the CMOS battery whenever the power supply has mains power, so the CMOS battery is only used when you unplug the computer entirely. The 5v SB line importantly allows components of your computer (most importantly the BIOS and the network adapters) to keep running some simple software even when the computer is turned off.
  • Intelligent power supply control. If you look at a pinout for your power supply's motherboard (P1) connector, you'll notice two pins typically labeled PS_ON and PS_RDY. These stand for "power supply on" and "power supply ready". If you like to experiment, take a power supply not in a computer, plug it in, and carefully short a ground line (one of the black wires) to the PS_ON line (the green wire). The power supply will visibly turn on, with the fan spinning up. The components of the motherboard running off of +5v SB actually turn your power supply on and off by connecting power to the PS_ON pin. Because there are some capacitors and other components in the power supply that take a moment to charge up, the voltages from the power supply's main outputs may not be stable immediately after the PSU turns on. This is what the PS_RDY pin is for, it comes on when the power supply's internal logic determines that the power supply is "ready" and will provide stable power. The motherboard waits until PS_RDY is on to continue booting.

So, your power switch no longer "turns on" the computer. Instead, it's connected to your motherboard's basic controllers, which detect that the button has been pressed and execute a number of steps to ready the system, including lighting up PS_ON so that power will be available. The power button isn't the only way to trigger the startup process, devices on your expansion bus can also do so. This is important because your Ethernet network adapters actually stay on when your computer is off and look for a very specific packet often referred to as the "Magic packet." If they detect this packet addressed to their MAC address, they will trigger the startup process. This is how "Wake-on-LAN" (WoL) works. The clock can also initiate a boot (most BIOS allow you to set a time that the computer should boot each day), and USB and FireWire devices can trigger a boot, although I'm not aware of any implementation of this.

Understanding Power Control

Well, I explain the Soft Power thing both because I think it's interesting (always a key reason that I explain things) and because it allows you to understand how the power and running/off state of your computer are all controlled by software. In most current computers, this software system is an implementation of the Advanced Configuration and Power Interface, or ACPI. ACPI is a standardized, unified system allowing software to control your computer's power system. You may have heard of the ACPI power states. The basic mechanism of power control is these "power states", your operating system switches through power modes by preparing for the switch (the shutdown/hibernate processes that occur prior to power actually flipping off), and then commanding the motherboard to switch power states. The power states look like this:

  • G0: Working (your computer's "on" state)
  • G1: Sleeping (your computer's standby states, divided in to the S substates)
    • S1: power to CPU and RAM remains on, but CPU is not executing instructions. Peripheral devices are powered off.
    • S2: CPU powered off, RAM maintained
    • S3: All components powered down except for RAM and devices that will trigger a resume (keyboard). When you tell your OS to "Sleep", it will stop processes and then enter this mode.
    • S4: Hibernation. Absolutely everything is turned off. When you tell your operating system to Hibernate, it stops processes, saves the contents of RAM to disk, and then enters this mode.
  • G2: Soft Off. this is your computer's "off" state. Power is off to everything except for devices that can trigger a boot.
  • G3: Mechanical off.

How reset actually happens

You'll notice that reboot is not one of these states. So what actually happens when your computer when it reboots? The answer may be surprising, because from a power management perspective it's almost nothing. There is an ACPI reset command. When you tell your operating system to reboot, it follows its normal shutdown process (stops all your processes, performs a bit of maintenance, dismounts your file systems, etc), and then as a final step, instead of sending the machine to power state G2 (as it would if you had simply told it to Shut Down) it sets the Reset command. This is generally referred to as the "Reset register", because like most of the ACPI interface it's just an address that a specific value should be written to in order to request a reset. I'll quote the 2.0 specification on what it does:

The optional ACPI reset mechanism specifies a standard mechanism that provides a complete system reset. When implemented, this mechanism must reset the entire system. This includes processors, core logic, all buses, and all peripherals. From an OSPM perspective, asserting the reset mechanism is the logical equivalent to power cycling the machine. Upon gaining control after a reset, OSPM will perform actions in like manner to a cold boot.

So, when the reset register is set, a few things happen in sequence.

  • All logic is reset. This means sending the respective reset commands to various bits of hardware including the CPU, memory controller, peripheral controllers, etc. In most cases this simply means lighting up a physical RST wire, as AndrejaKo described.
  • The computer is then bootstrapped. This is the "perform actions in like manner to a cold boot" part. The motherboard performs the same steps as it would if the power supply had just become ready after the power button being pressed.

The end effect of these two steps (which actually break down in to a lot more steps) is that it looks to everything just like the computer just booted, but the power was actually on the whole time. This means less time required to shut down and start up (since you don't have to wait for the power supply to become ready), and importantly allows the bootup to be initiated by the operating system shutting down. This means that another startup trigger doesn't need to be used (WoL etc), and allows you to use Reboot as an effective way to reset the system remotely, when you don't have a way to trigger boot.

That was a long answer. But hey, hopefully you know more about computer power management now. I certainly learned some things researching this.

  • 4
    +1. Very informative & useful answer. Just one point - PS_ON is active low ie switched to 0V rather than +5VSB to turn the main outputs on.
    – MikeJ-UK
    Commented Jun 9, 2011 at 8:23
  • 2
    For USB devices triggering a boot, some BIOSes have an option to wake the computer on a double-click or keypress. Also, some Mac keyboards have Power buttons (a tradition going all the way back to the original). Commented Jun 9, 2011 at 16:41
  • 1
    Great answer, I certainly learned a lot. One question remains, though: from the motherboard's point of view, what is the difference between S4 and G2 states? Saving RAM to disk is done by the OS, so S4 sounds just like "soft off" for the hardware.
    – EMP
    Commented Jun 10, 2011 at 1:17
  • 1
    I believe S4 is functionally equivalent to G2, but the difference is stored. Some BIOS appear to do a "quick POST" when starting from S4 but a full POST when starting from G2. I don't think there's any reason for this, though, other than that people want S4 resume to be fast. Commented Jun 10, 2011 at 1:21
  • 1
    That's actually a bit simplistic; there are (many) non-ACPI ways to reboot the computer, and sometimes ACPI alone doesn't work: superuser.com/questions/294681/…
    – Tobu
    Commented Jun 15, 2011 at 23:11

Here's a starting point:

Chips usually don't turn off and then turn on. Instead, there's a reset line which will bring processor in so-called reset state when usually all memory is cleared and processor looks like it's just been powered on. While that pin is held high (or low, depending on the processor), the processor is in reset. Once the pin is released, it will continue booting normally, just as if it was turned on for the first time. The point of this is that there's no power cut itself.

So how does this scale to larger systems like modern PCs? Well modern computers are made out of computers which are sometimes made out of computers themselves. So when you set computer to reset, "computers" which make the computer will start saving their states (if the reset is controlled), or just have their reset pins pulled.

Some processors and microcontrollers (which are miniature self-contained computers, usually 20 years behind the modern desktop computers) can reset themselves using internal switches. As I said, once the signal which generates reset is gone, the computer will start up. So the premise in the question isn't completely right. Computer doesn't know when to turn on. In know when it needs to be "off" or in reset and when the signal which keeps it there is gone, it will turn on.

This behavior may look strange on modern computer which can be set to turn on at specific time or over network and so on. As I said computers are made of computers. So while the main processor may be off, there could be numerous other chips and microcontrollers inside which are on. The most obvious case is the real-time clock which is often battery powered. It can then turn on other chips which will turn on other chips and the chain reaction goes until the whole computer is on. On today's computers, there's a PSU line called +5 VDC Standby Voltage. It provides around 50 mW power to various devices that are on when computer is "off".

A little bit of trivia: Reset pin on Intel 386 EX processor is pin number 110.

386EX datasheet figure 2

On Intel i7-900 it's land number AL39.

I hope that someone will be able to provide an answer which will explain how things work from the high level point of view, since it's quite complicated system.

  • Wow, thorough answer. Commented Jun 8, 2011 at 20:35
  • 13
    @Seth Carnegie It's not that great. I just touched the low level stuff that's true for most computers, from the one in a refrigerator to PC. I didn't even mention the ACPI, APM and other modern power systems or how on old PCs Intel 8042 microcontroller which controller the keyboard could reset the processor, how the POST works, reset vectors and many other things.
    – AndrejaKo
    Commented Jun 8, 2011 at 20:47
  • 1
    @netvope Too much to imagine, I'd say. You probably have at least one in your mouse, one in keyboard, more than 10 for the most basic parts of the motherboard (even if we take into account highly integrated "chipsets"), maybe one in the power supply unit, At least one in each drive (more likely 2-3), several in each expansion card... Monitors are serious business too and my printer now has more RAM than my first desktop computer.
    – AndrejaKo
    Commented Dec 30, 2011 at 3:03
  • 4
    Talking about memory, the caches of some new HDDs and CPUs are now bigger than the RAM of the first computer I've used. We can now run Windows 95 entirely in the L2 cache and keep the whole system partition in the drive cache!
    – netvope
    Commented Dec 30, 2011 at 3:57

This blog post describes how Linux triggers a reboot.


Linux has a bunch of different ways to reset an x86. Some of them are 32-bit only and so I'm just going to ignore them because honestly just what are you doing with your life. Also, they're horrible. So, that leaves us with five of them.

  • kbd - reboot via the keyboard controller. The original IBM PC had the CPU reset line tied to the keyboard controller. Writing the appropriate magic value pulses the line and the machine resets. This is all very straightforward, except for the fact that modern machines don't have keyboard controllers (they're actually part of the embedded controller) and even more modern machines don't even pretend to have a keyboard controller. Now, embedded controllers run software. And, as we all know, software is dreadful. But, worse, the software on the embedded controller has been written by BIOS authors. So clearly any pretence that this ever works is some kind of elaborate fiction. Some machines are very picky about hardware being in the exact state that Windows would program. Some machines work 9 times out of 10 and then lock up due to some odd timing issue. And others simply don't work at all. Hurrah!

  • triple - attempt to generate a triple fault. This is done by loading an empty interrupt descriptor table and then calling int(3). The interrupt fails (there's no IDT), the fault handler fails (there's no IDT) and the CPU enters a condition which should, in theory, then trigger a reset. Except there doesn't seem to be a requirement that this happen and it just doesn't work on a bunch of machines.

  • pci - not actually pci. Traditional PCI config space access is achieved by writing a 32 bit value to io port 0xcf8 to identify the bus, device, function and config register. Port 0xcfc then contains the register in question. But if you write the appropriate pair of magic values to 0xcf9, the machine will reboot. Spectacular! And not standardised in any way (certainly not part of the PCI spec), so different chipsets may have different requirements. Booo.

  • efi - EFI runtime services provide an entry point to reboot the machine. It usually even works! As long as EFI runtime services are working at all, which may be a stretch.

  • acpi - Recent versions of the ACPI spec let you provide an address (typically memory or system IO space) and a value to write there. The idea is that writing the value to the address resets the system. It turns out that doing so often fails. It's also impossible to represent the PCI reboot method via ACPI, because the PCI reboot method requires a pair of values and ACPI only gives you one.

  • 1
    tl;dr there are many ways to reboot; some boards are broken badly enough that pretend to be windows, a heuristic that involves a few tries and sleeping a bit, is the only way.
    – Tobu
    Commented Jun 15, 2011 at 23:02

It frobs an I/O location which pulls a data line low which tells the CPU that it should stop whatever it's doing and start running code from a certain location in the BIOS.

  • ...and that location is specified in the code that is passed to the reboot system call ? Commented Jul 28, 2010 at 21:25
  • 1
    @Knight Samar: No; the I/O location is generally an architecture constant, which the kernel knows. You can see this e.g. in the Linux reboot code, such as arch/x86/kernel/reboot.c .
    – sleske
    Commented Jul 28, 2010 at 22:19
  • does anyone have a good rescource for further reading on that matter? Commented Jul 29, 2010 at 11:19
  • @mugen.kenichi and all, a friend gave me this to refer howstuffworks.com/bios.htm/printable Commented Jul 30, 2010 at 19:17
  • I suggest superuser.com/a/347115/38062 .
    – JdeBP
    Commented Oct 29, 2017 at 7:49

Back in the old days before power management, computers could still restart themselves, of course. (Anybody remember when a frozen program meant you had to use Ctrl+Alt+Delete to reboot the computer?)

On my old 486, the assembly language command JMP FFFF:0000 (ie, set the CPU's Instruction Pointer to said address) would cause the whole computer to restart. In other words, FFFF:0000 addresses a location in BIOS that has instructions for what the computer should do when it first starts. I suspect the Reset Pin described by AndrejaKo's answer, or reset buttons in the pre-power-management days, would also force the Instruction Pointer to the same address.

A Google search for JMP FFFF:0000 reveals many interesting pages about this.

  • 3
    You also needed to write a specific value to 0040:0072 to determine whether it was a cold (0x0000) or warm boot (0x1234).
    – Synetech
    Commented Aug 2, 2011 at 5:36

There is also a thing named the watchdog. This device serves as a dead-man's switch. The computer has to signal to the watchdog every say minute that it is still alive. When the computer crashes, e.g. by running into an endless loop, it will fail to signal to the watchdog it is still running as intended, on which occasion the watchdog will perform a hardware reset. This was demonstrated in the popular tv series of the terminator, where a robot was knocked out by a high voltage power surge. it would reset itself in 2 minutes.

  • 2
    This is correct, but does not really answer the question.
    – sleske
    Commented Jun 9, 2011 at 15:00
  • 4
    Are there watchdogs that will actually restart entire computer? I know that they are sometimes used for various microcontrollers inside the computer, but is there one on a whole computer level? My personal experience leads me to say no, but some evidence for or against would be welcome.
    – AndrejaKo
    Commented Jun 9, 2011 at 19:03
  • 5
    @AndrejaKo: I used to work for a company that made communication servers (essentially blade servers with modems connected to them). They had a watchdog timer that was connected to the reset pins on the motherboard. The timer was bumped periodically by a background utility running on the motherboard, so if the processor hung, the watchdog would eventually push the reset button. It was tied to a circuit that made the phone line busy while the motherboard rebooted. Commented Jun 9, 2011 at 23:51

Back on the old IBM PC-1 the keyboard controller, oddly enough, handled reboot. IBM embedded a small microprocessor to handle the keyboard, and it had some spare I/O lines, so they used one of the lines to drive the reset line of the main CPU. A command sent to the keyboard controller would result in the CPU being reset as if power had just been switched on.

I'm guessing this tradition continued well into the "AT" era, and there may be vestiges of it remaining in ACPI today.

Added: There's an interesting detail about the above reset scheme. During the early boot sequence the code looked for a particular pattern in RAM that might have been set by the previously executing code. If this code was present some of the POST (power-on self-test) diagnostics were skipped. The pattern would only be present on a "warm" boot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .