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