I have moved my blog to Wordpress at theunixgeek.wordpress.com. I will still be checking back periodically on this one as well, though. 19 April 2009


Merging Mkdir and Cd | 280 Slides Interview | I Switched to KDE 4

clickable portals

Wednesday, February 18, 2009

How Linux Shuts Down

Have you ever wondered how a computer can turn itself off without any manual controls? It's quite simple, actually. Here's how it works in Linux:

First off, all running processes are terminated. This means first closing files (and, in certain cases, saving them) to ensure that the system's stability is maintained and then completely forcing all processes to stop.

Afterwards, all external (non-root*) filesystems (including swap partitions) are unmounted.

If anything goes wrong in any of these steps, the filesystem may become unstable and may even render the installation useless. This is a warning to not interrupt your computer while it is being shut down! I personally know someone who happened to do so; his root filesystem became corrupted and a reinstallation had to be done.

For the actual hardware shutdown, a signal is sent to the power supply (similarly to how a signal can be sent to open a disc drive), which triggers the final shutdown.

(thanks to Tobor for help on the hardware info)

* root here means the root directory, not the root user.