Why is ubuntu shutdown so fast compared to Windows 7

I have installed Windows 7 64 bit and Ubuntu 10.10 32 bit on my machine. The partition sizes are 400 GB and 100 GB receptively. I've always wondered how Ubuntu shuts down so fast? It takes only 5 seconds or less whereas Windows 7 takes a lot longer.

Although, I have more programs installed on Windows 7, but still its shut down time was much more than that of Ubuntu during first month of install. It was 10-15 sec approx. I'm not counting the time used for installing updates sometimes, when shutdown is clicked in Windows 7.

What makes Ubuntu shutdown and boot(faster than Windows 7 but not by wide margin) so fast. Is it the file system? will it be other way around if I had swapped partitions spaces(Can't try this now)? Sorry I don't have Computer Science background, so don't know detailed structure and architecture of OS. Any pointers to this will help me cure my curiosity.


<p rant="on"> Well, to be honest, I don't think understand why will do programming any good. In addition, I don't honestly understand why this is migrated to SU in the first place (Other than SU being a rubbish bin for all irrelevant questions for many stackoverflow users</p>

The windows shutdown process can be seen as a two step process:

  • from "Logged on" to "No one logged in" (Hereinafter "Part 1")
  • from "No one logged in" to "Shutdown" (Hereinafter "Part 2")

In part 1:

ExitWindowsEx(uFlags,dwReason) is called - this is actually handled by winlogon. It sends WM_QUERYENDSESSION to all applications - and each of the application shall perform necessary procedures before shutdown and return true. It then receives WM_ENDSESSION and is terminated. This relates to all process in session 1 (The so-called "interactive session")

Then:

  • user profile is updated and unloaded
  • network connection (including VPN connections, if any) is terminated
  • COM processes are terminated

In part 2:

The non-interactive session (session 0) would also have all its application terminated in similar manner (Impersonating Local System user account), and services would be shut down.

After all these, the system would be shutdown.