現在可以安全關閉計算機了


120

我小時候記得的一件事是在舊計算機關閉過程結束時看到的屏幕:

enter image description here

我不知道這是否僅適用於Windows 95/98/2000 / ME,但我想知道為什麼那時候的計算機必須手動關閉。實現自我關閉真的很難嗎?計算機要花很長時間才能實現此功能的原因是什麼?

0

This was purely a PC thing. Older retro computers (8/16 Bit Homecomputer) had always physical switches you needed to operate manually. Also as they were missing HDs, you could switch them off anytime (risking only to break the current floppy if it was just written to).

PC was build from standard components and a lot of manufacturers needed to cooperate:

  • mainboards needed to support the feature
  • cases needed to support that "new powerswitch"
  • OS needs to have a "driver" to switch off and on
  • CPU (?)
  • may forgot more components here

The first implementation was called APM (Advanced Power Management) and was defined by Microsoft and Intel in January 1992 (1.0), 1.1 was released in September 1993 and 1.2 was released in 1996.
APM was succeeded by ACPI(Advanced Configuration and Power Interface) in December 1996 which also added functions for HW detection (for example Multiprocessor environment and Plug and Play).


152

TL;DR: it took a long time (on PCs) because the industry wasn’t ready to push it. Scroll down to “Why did it take so long?” for details.

Shutdown screens

That screen comes from Windows 95 and its successors, 98 and Me. Windows NT showed a plain dialog box with a “Restart” button. Other operating systems which cared about managing the shutdown process had equivalents — OS/2 for example, and all the Unix variants (sometimes it was only a text message on the console). Raymond Chen wrote an amusing blog post illustrating the importance of the instructions in the shutdown screen.

Some history...

Before 1995 and the adoption of the ATX standard, the vast majority of desktop PCs had power switches which were directly connected to the power supply, and acted as mechanical switches only, interrupting the electric circuit when opened. It was therefore impossible for software to control the state of the power supply. But that wasn’t much of a problem initially: when the IBM PC was designed, storage media (including hard drives) had no caches, so when the hardware told the operating system that a write was finished, it really was. Under DOS, the kernel and shell worked together to ensure that when the DOS prompt was displayed, all the buffers were flushed; when software caches appeared, they adhered to this too (at least, the well-behaved ones did). Users were taught to exit programs, wait for the prompt, and wait for drive lights to switch off before powering the system down. (They might also need to PARK the drive heads but that’s another story.) Even with pre-95 versions Windows, users exited to DOS before switching the system off.

Windows 95 and other multi-tasking operating systems changed the picture: they didn’t “exit to DOS” on shutdown (either because they weren’t supposed to, or because there was no DOS to return to), so users couldn’t wait for a prompt to appear before switching off. In most truly multi-tasking systems there’s never really a quiescent state where the system is safe to power off, in normal operation; so most multi-tasking operating systems have a way for the user to say “I want to power the system down, prepare to do so”, and the operating system then needs to tell the user when it’s safe to power off. This ensures that all applications have finished writing the user’s files to disk, and that the system is in a consistent state (ignoring hard drive caches here...).

Shutting down PCs

Two features brought system power under operating system control: APM on the one hand, and ATX on the other. APM, which was designed for laptops initially, provided mechanisms for software to request changes in the system’s power state: fully on, in standby, suspended, or off. ATX changed the physical connections in the system so that power control became possible everywhere: it required that the power button no longer be a switch directly connected to the power supply, but instead that it be connected to the motherboard, and that the motherboard control the power supply itself. The power supply was also changed so that it would supply a small amount of current all the time, allowing the system to be left in “soft off” status, i.e. with enough capabilities to turn itself back on again when requested to do so.

You can see an example of the use of APM to power off a PC in Shutdown, a small assembly-language program written for DOS. Operating systems such as Windows 95 (with the APM drivers installed) would do the same thing.

It was quite exciting (to me anyway) to see APM and ATX roll out progressively in the second half of the nineties, and see systems suddenly acquire the ability to turn themselves off without human intervention, and to turn themselves back on at the press of a key on some systems. This was yet another sign of PCs “growing up” (“real” computers, i.e. Unix workstations in my mind at the time, had had the ability for a while, as had Macs).

Why did it take so long?

All this doesn’t address the actual question:

Was it really that hard to implement a self shut-off? What is the reason it took quite long for computers to feature this.

If you design it in from the start, it’s not all that hard to implement self shut-off, and many systems existed with this ability quite a few years before the PC acquired it.

I think the main reason it took so long is industry fragmentation. IBM designed the first PCs, and the majority of clones in the eighties and early nineties followed the blueprint set by the AT (or rather, the Baby-AT variant and LPX power supplies). But IBM moved on to the PS/2, which was a rather proprietary derivative of the PC, and left the rest of the industry to fend for itself. There was no real driver for big changes for many years: people continued using DOS, on its own then with Windows, and while there were other operating systems, none of them was successful enough to be able to drive change. No hardware manufacturer was dominant enough either. Various ad hoc consortia were created, e.g. for EMS (Lotus, Intel, and Microsoft), and more markedly when it comes to hardware, EISA (the “Gang of Nine”, led by Compaq), VESA, etc. Various de facto standards emerged, but no one was defining the PC platform, and operating system-controlled power-off wasn’t an important enough feature to mobilise the industry.

In the early nineties, surprising as it may seem now, there was a fair amount of uncertainty as to what the computing future held. Apple was making its comeback with cheaper Macs, workstation manufacturers were releasing lower-priced systems (or rather, not-so-expensive systems), a variety of operating systems and platforms were vying for attention (Be, RiscPC...), IBM was still pushing OS/2 and Taligent, Microsoft was pushing Windows NT, etc.

Eventually an alliance of companies took it upon itself to “remedy” this situation: Intel and Microsoft (referred to at the time as Wintel). This started in the early nineties, but wasn’t a done deal for quite a while; when ATX was published in 1995 (by Intel on its own), pundits liked it but weren’t sure it would convince the industry, although they were proved wrong fairly quickly. Windows 95 sealed the deal though and Intel and Microsoft became the definers of the PC platform (with the PC System Design Guide in particular).

On to the present day

APM is now obsolete, and ACPI is the interface which provides access to the power state nowadays (and many other aspects of the system). Pressing the power switch now only informs the system that the button was pressed, and it’s up to whatever’s controlling the system at that point to decide what to do with that information — which is nice because you no longer risk losing your work if someone accidentally presses the button!

(PCs never acquired the other hardware feature I wanted from Macs and Unix workstations, which was the ability to eject floppies without human intervention. Oh well...)


7

The versions of Windows that displayed that message used the FAT filesystem. FAT does not have any atomic write capability - that is, if power is lost while data is being written it can corrupt the filesystem. This was such a common problem that Microsoft included a tool (chkdsk) that would detect and attempt to fix it every time the machine booted.

To avoid this happening users were told not to simply turn their computers off. Other systems around at that time, such as the Amiga, Mac and DOS based PCs, could simply be turned off when the user was finished using them, with a few caveats such as waiting for floppy drive lights to go out. Windows 95 introduced virtual memory and write caching for performance reasons, which required a clean shut down to avoid filesystem corruption.

Since older AT machines could not power themselves off like newer ATX ones could, Windows would display this message when it was ready to be switched off.


46

Was it really that hard to implement a self shut-off?

Yes. Yes it was.

Until Windows 95, all power switches were that - a switch. On or off, nothing else, and there was no "self shut-off". Nor was there a requirement for it.

The advent of Windows 95 and the possibility of the system saving state before shutting down cleanly created a market requirement for power-off to be controlled by software. This led to the development of the standardised ACPI interface and ATX power supplies to implement the new requirement, a year after Win95 had exposed the need for it.

But until this had been designed, implemented in the OS, and implemented in the BIOS, of course the only way of powering off your PC was with the on/off switch. Hence the famous message.