强制重启计算机_我的计算机如何能够自行重启?

强制重启计算机

强制重启计算机

It’s such a common place activity that most of us have likely never stopped to even think about it: the automatic restart. Whether user or application-initiated, what exactly happens when your computer cycles its own power?

这是一个非常常见的场所活动,我们大多数人可能甚至从未想过:自动重启。 无论是用户启动还是应用程序启动,当计算机重新启动电源时会发生什么?

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-drive grouping of Q&A web sites.

今天的问答环节由SuperUser提供,它是Stack Exchange的一个分支,它是Q&A网站的社区推动组织。

问题 (The Question)

SuperUser reader Seth Carnegie wonders about computer power management:

超级用户读者Seth Carnegie对计算机电源管理感到惊奇:

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?

计算机如何自行重启? 关闭后,如何告诉自己再次重新启动? 什么样的软件可以做到这一点?

How indeed? What combination of software/hardware magic makes it happen?

确实如何? 软件/硬件魔术的什么组合使其成为现实?

答案 (The Answer)

SuperUser contributor Jcrawfordor offers both a condensed and detailed response to the question that more than adequately addresses the question:

超级用户贡献者Jcrawfordor对问题进行了简短而详尽的回答,远远超过了该问题:

The too long;didn’t read it answer: 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.

太长;看不懂它的答案:计算机中的电源状态由ACPI的实现(高级配置和电源接口)控制。 关闭过程结束时,操作系统将设置ACPI命令,指示计算机应重新启动。 作为响应,母板使用各自的重置命令或线路重置所有组件,然后执行引导程序。 主板从未真正关闭过,它只会重置各种组件,然后像刚按下电源按钮一样工作。

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.

在过去(好吧,对于像我这样的90年代的大学生来说,是很久以前的事情了),我们有带AT电源管理功能的AT(先进技术)主板。 AT电源系统非常非常简单。 您计算机上的电源按钮是一个硬件开关(可能在机箱背面),您的120vac输入正好通过它。 它实际上打开和关闭了电源的电源,并且当此开关处于“关闭”位置时,计算机中的所有设备都完全没电了(这使CMOS电池非常重要,因为没有电源,就无法保持硬件时钟滴答声)。 因为电源开关是一种物理机制,所以没有软件方法可以打开和关闭电源。 Windows将显示著名的“现在可以安全关闭计算机”消息,因为尽管所有内容都已停放并准备关闭,但OS实际无法打开电源开关。 有时将这种配置称为硬电源 ,因为它全是硬件。

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:

如今,情况有所不同,因为ATX主板和ATX电源的奇妙之处(如果您一直在跟踪,那就是高级技术)。 除了其他许多进步(mini-DIN PS / 2,有人吗?),ATX还带来了强大的功能 。 软电源意味着可以通过软件控制计算机的电源。 这带来了一些导入更改:

  • 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.

    备用电源:您可能已经看到电源引脚上标有“ 5v SB”或“ 5v备用”连接器。 备用电源是连接到主板的5v线,即使计算机已关闭,它也始终打开。 这就是为什么在维修现代计算机时拔出或关闭PSU硬开关(如果有)很重要的原因,因为即使电源关闭,您也可能会短路5v SB并损坏主板。 这也是为什么CMOS电池不再那么重要的原因-只要电源具有市电,就可以使用5v SB替换CMOS电池,因此仅在完全拔掉计算机电源时才使用CMOS电池。 5v SB线很重要地使您的计算机组件(最重要的是BIOS和网络适配器)即使在关闭计算机后仍可以运行某些简单的软件。

  • 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.

    智能电源控制。 如果查看电源的主板(P1)连接器的引脚,则会注意到两个引脚通常标记为PS_ONPS_RDY 。 这些代表“电源打开”和“电源准备就绪”。 如果要进行实验,请不要在计算机中插入电源,将其插入,然后小心地将接地线(黑色线之一)与PS_ON线(绿色线)短路。 风扇旋转时,电源将明显打开。 通过+ 5v SB运行的主板组件实际上通过将电源连接到PS_ON引脚来打开和关闭电源。 由于电源中的某些电容器和其他组件需要花费一些时间才能充电,因此在PSU开启后,电源主输出的电压可能会不稳定。 这就是PS_RDY引脚的用途,当电源的内部逻辑电路确定电源已“就绪”并且将提供稳定的电源时,它就会亮起。 主板等待直到PS_RDY打开才能继续引导。

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.

因此,电源开关不再“打开”计算机。 而是将其连接到主板的基本控制器,该控制器检测到该按钮已被按下,并执行许多步骤来准备系统,包括点亮PS_ON以使电源可用。 电源按钮不是触发启动过程的唯一方法,扩展总线上的设备也可以这样做。 这很重要,因为当计算机关闭时,您的以太网网络适配器实际上会保持打开状态,并查找非常特殊的数据包,通常称为“魔术数据包”。 如果他们检测到寻址到其MAC地址的数据包,则将触发启动过程。 这就是“局域网唤醒”(WoL)的工作方式。 时钟还可以启动启动(大多数BIOS允许您设置计算机每天启动的时间),并且USB和FireWire设备可以触发启动,尽管我不知道此实现方式。

了解电源控制 (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:

好吧,我之所以解释Soft Power是因为我认为这很有趣(这始终是我解释事情的关键原因),还因为它使您能够了解计算机的电源和运行/关闭状态是如何由软件控制的。 在当前的大多数计算机中,该软件系统都是“ 高级配置和电源接口”或ACPI的实现 。 ACPI是标准化,统一的系统,允许软件控制计算机的电源系统。 您可能听说过ACPI电源状态 。 电源控制的基本机制是这些“电源状态”,您的操作系统通过准备开关(电源实际断开之前发生的关机/Hibernate过程)来切换电源模式,然后命令主板切换电源状态。 电源状态如下所示:

  • G0: Working (your computer’s “on” state)

    G0:工作(计算机的“开启”状态)
  • G1: Sleeping (your computer’s standby states, divided in to the S substates)

    G1:睡眠(计算机的待机状态,分为S子状态)

    • S1: power to CPU and RAM remains on, but CPU is not executing instructions. Peripheral devices are powered off.

      S1:CPU和RAM的电源保持打开,但CPU未执行指令。 外围设备已下电。
    • S2: CPU powered off, RAM maintained

      S2:CPU断电,保持RAM
    • 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.

      S3:除RAM和将触发恢复操作的设备(键盘)外,所有组件均已掉电。 当您告诉操作系统“睡眠”时,它将停止进程,然后进入此模式。
    • 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.

      S4:Hibernate状态。 绝对一切都已关闭。 当您告诉操作系统进入Hibernate状态时,它将停止进程,将RAM的内容保存到磁盘,然后进入此模式。
  • G2: Soft Off. this is your computer’s “off” state. Power is off to everything except for devices that can trigger a boot.

    G2:软关闭。 这是计算机的“关闭”状态。 除了可以触发启动的设备以外,所有设备都已关闭电源。
  • G3: Mechanical off.

    G3:机械关闭。

重置实际上是如何发生的 (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:

您会注意到重启不是这些状态之一。 那么,当计算机重新启动时,实际发生了什么? 答案可能令人惊讶,因为从电源管理的角度来看,它几乎没有 。 有一个ACPI重置命令 。 当您告诉操作系统重新引导时,它会遵循其正常的关闭过程(停止所有进程,进行一些维护,卸下文件系统等),然后作为最后一步,而不是将计算机置于电源状态G2(如果您只是简单地告诉它要关机),它将设置Reset命令。 这通常称为“复位寄存器”,因为像大多数ACPI接口一样,它只是一个地址,应将特定值写入该地址才能请求复位。 我将引用2.0规范的作用:

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.

可选的ACPI重置机制指定了提供完整系统重置的标准机制。 实施后,此机制必须重置整个系统。 这包括处理器,核心逻辑,所有总线和所有外围设备。 从OSPM角度来看,断言重置机制在逻辑上等效于对机器重新通电。 重置后获得控制权后,OSPM将以类似于冷启动的方式执行操作。

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 showed up above.

    重置所有逻辑。 这意味着将各自的重置命令发送到硬件的各个位,包括CPU,内存控制器,外围控制器等。在大多数情况下,这仅意味着点亮物理RST线,如AndrejaKo上面所示。
  • 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.

这两个步骤(实际上可以分解为更多的步骤)的最终结果是,它看起来就像刚启动的计算机一样,但实际上却是整个过程都在起作用。 这意味着关闭和启动所需的时间更少(因为您不必等待电源准备就绪),并且重要的是允许通过关闭操作系统来启动启动。 这意味着不需要使用其他启动触发器(WoL等),当您没有触发启动的方法时,它允许您将“重新启动”用作远程重置系统的有效方法。

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

那是一个很长的答案。 但是,希望您现在对计算机电源管理有了更多的了解。 我当然学习了一些东西。


Have something to add to the explanation? Sound off in the the comments. Want to read more answers from other tech-savvy Stack Exchange users?
有什么补充说明吗? 在评论中听起来不对。 是否想从其他精通Stack Exchange的用户那里获得更多答案? Check out the full discussion thread here. 在此处查看完整的讨论线程

翻译自: https://www.howtogeek.com/127323/how-is-my-computer-able-to-restart-itself/

强制重启计算机

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值