Linked by David Adams on Sat 17th May 2008 03:39 UTC, submitted by IdaAshley
General Unix Ever wonder what makes a computer tick or how a UNIX server does what it does? Discover what happens when you push the power button on your computer. This article discusses the different boot types, managing the AIX bootlist and the AIX boot sequence. After reading this article, you will better understand what exactly happens when your server starts.
Thread beginning with comment 314651
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: Comment by Kroc
by sonic2000gr on Sat 17th May 2008 19:34 UTC in reply to "Comment by Kroc"
sonic2000gr
Member since:
2007-05-20

What I'd like to know is what an OS does when it shuts down??
Why does it even touch the disk at all?


An (oversimplified) explanation is this:

Most of the processes you mention maintain data files on the filesystem, constantly reading and writing to it. An obvious example is e.g. a database system. The OS itself does not immediately commit all writes to disk: it prefers to keep some of them in memory and flush them to disk at the best opportunity (i.e. when load is low etc). This is necessary, since disk writes are costly (hard disks may be very fast these days, but they are still a lot slower than main memory). Other things to consider are: Processes which are swapped out to disk, files that are cached and so on. At any point in time, the filesystem has open files, with data either waiting in memory to be written or being currently written. When an application knows it will access the file again soon, it will not close and reopen it (this is costly as well).
When you shutdown, every process must be stopped, and all the data has to be actually written on the disk platters. Only then is the filesystem consistent and ready to be unmounted. Depending on how many apps are running and the amount of writes still pending, this may take some time.
Having said that, I rarely turn off my Linux/BSD systems, so this does not affect me ;)

Edited 2008-05-17 19:36 UTC

Reply Parent Bookmark Score: 2

RE[2]: Comment by Kroc
by Kroc on Sat 17th May 2008 20:12 in reply to "RE: Comment by Kroc"
Kroc Member since:
2005-11-10

In that case Vista must decide to rewrite the entire hard disk just for good luck, with the amount of churning and how long it takes. I've seen Vista laptops take three to four whole minutes to shut down! That isn't dumping buffers, that's earnestly trying to hit the MTBF

Reply Parent Bookmark Score: 6

RE[3]: Comment by Kroc
by sonic2000gr on Sat 17th May 2008 20:23 in reply to "RE[2]: Comment by Kroc"
sonic2000gr Member since:
2007-05-20

Hehe, I haven't experienced that long delays on my Vista laptop yet. However, there is a solution: Whenever possible, do not shutdown, just hibernate.

Reply Parent Bookmark Score: 2

RE[3]: Comment by Kroc
by Googol on Sun 18th May 2008 20:46 in reply to "RE[2]: Comment by Kroc"
Googol Member since:
2006-11-24

My Vista beats 3 min hands down ! ;)

No really, it shuts down normally since SP1.

Reply Parent Bookmark Score: 2

RE[2]: Comment by Kroc
by Doc Pain on Sun 18th May 2008 10:12 in reply to "RE: Comment by Kroc"
Doc Pain Member since:
2006-10-08

Regarding the question

What I'd like to know is what an OS does when it shuts down??
Why does it even touch the disk at all?


you gave a good explaination. I'd like to add the following:

Most users coming from a PC background do not see that UNIX is meant as a multi-user multi-process operating system. So it may be possible that many users are working on the same machine when it shuts down. The OS usually gives shutdown warnings, giving users the time to finish their work. Then, specifig signals are used to make the running applications do their own "shutdown stuff", e. g. saving unsaved files to disk so they don't get lost even if the user forgot to save them. After this, the applications are requested to terminate theirselves.

As you mentioned, data usually is written asynchronously. So the OS usually waits some time until all buffers are flushed at shutdown.

Having said that, I rarely turn off my Linux/BSD systems, so this does not affect me ;)


Understandable. :-)

Reply Parent Bookmark Score: 3

RE[3]: Comment by Kroc
by Henrik on Sun 18th May 2008 13:40 in reply to "RE[2]: Comment by Kroc"
Henrik Member since:
2006-01-03

As I see it, these people complaining of long startup/shutdown times have all the right in the world to be dissapointed with "modern" OSes in this respect - taking into account that (their) earlier very simple machines like the Amiga, C64 and the ZX Spectrum did this in one second or so, literally. Also lots of computer-like appliances such as mobiles, MP3 players, PDAs etc, do the same - this is true regardless of technical resons!

As a 42 year old man coming from a diverse electronics, PC, mathematics, compiler design, and datalogi ("computer science") background, I certainly see that "UNIX is meant as a multi-user multi-process operating system". In fact, I have tried to figure out - for the last quarter of a century or so - why an old time-sharing system like UNIX would be regarded a good basis for something resembling a personal computer.

UNIX was originally designed back when CPUs were almost 100 times as expensive as today and therefore had to be shared among many users. Computers were also at least 1000 times as slow and had perhaps 1/10000 the amount of memory, which originally restricted operations to primitive serial character processing very far from today's graphical interfaces. As most people here know, this has very strongly affected the basic architecture of UNIX, and this backround does not fit today's and tomorrow's demands very naturally (with many CPUs per user instead of the other way round).

UNIX/Linux should probably be redesigned almost from the ground up, or simply replaced, when in comes to use in personal computers (servers are another matter).

Moreover, today, the habit of not turning a PC off (or even "hibernate") in order to hide the ridiculously looong boot times is simply immoral, as power draw from computers has emerged as a major environmental problem - think about if we did the same with our TVs.

Edited 2008-05-18 13:43 UTC

Reply Parent Bookmark Score: 2