What Does Shutdown Do?

A place to discuss the science of computers and programs, from algorithms to computability.

Formal proofs preferred.

Moderators: phlip, Moderators General, Prelates

RThaiRThai
Posts: 22
Joined: Sat Jun 27, 2009 8:02 am UTC

What Does Shutdown Do?

Postby RThaiRThai » Wed Sep 01, 2010 7:32 pm UTC

One would think Google would be sufficient, but I tried that and Wikipedia without getting a satisfying answer.

Why does shutting down take the time it does? With Windows it makes sure I save everything before shutting down, but even after that it takes a while. What is wrong with just switching off the power?

It's something I was wondering after reading a Slashdot article.

User avatar
sircrayons
Posts: 86
Joined: Wed Mar 10, 2010 3:17 am UTC
Contact:

Re: What Does Shutdown Do?

Postby sircrayons » Wed Sep 01, 2010 7:54 pm UTC

Well, there are plenty of things going on behind the scenes when your computer is on. When you shut down properly, it gives those things a chance to clean themselves up and exit gracefully. That is, shutting down properly gives each process running on your computer a chance to shut down properly. Perhaps they have open files or something. Imagine if Windows was installing an update in the background, and you pulled the plug. It's entirely possible that critical system files may have been damaged in doing so because you didn't allow Windows time to clean up. Perhaps there is data in RAM that hasn't yet been saved (this is also a reason why you need to "safely remove" USB drives). Certain hardware may also need time to shutdown properly, like your hard drive.
"Ford, you're turning into a penguin. Stop it."

User avatar
Josephine
Posts: 2142
Joined: Wed Apr 08, 2009 5:53 am UTC

Re: What Does Shutdown Do?

Postby Josephine » Thu Sep 02, 2010 12:05 am UTC

why not dump the RAM to hard drive like when a computer hibernates? You wouldn't have to go through the process of restarting all the processes.
Belial wrote:Listen, what I'm saying is that he committed a felony with a zoo animal.

letterX
Posts: 535
Joined: Fri Feb 22, 2008 4:00 am UTC
Location: Ithaca, NY

Re: What Does Shutdown Do?

Postby letterX » Thu Sep 02, 2010 1:46 am UTC

That's still additional step that's not just cut-the-power-and-let-processes-deal-with-it.

Anyways, even if hibernation is your default shutdown, you still want to be able to tell everything really to wrap up so that you can cleanly reboot the system. Sometimes there's nothing better than a power-cycle to fix your problems.

User avatar
PhoenixEnigma
Posts: 2303
Joined: Fri Sep 18, 2009 3:11 am UTC
Location: Sasquatchawan, Canada
Contact:

Re: What Does Shutdown Do?

Postby PhoenixEnigma » Thu Sep 02, 2010 1:58 am UTC

letterX wrote:That's still additional step that's not just cut-the-power-and-let-processes-deal-with-it.

Anyways, even if hibernation is your default shutdown, you still want to be able to tell everything really to wrap up so that you can cleanly reboot the system. Sometimes there's nothing better than a power-cycle to fix your problems.
Indeed. If you have something that has a memory leak (which, unfortunately, isn't unheard of), shutting down and restarting will clean things up, while hibernating allows the problem to continue.

There's also the fact that if you have a lot of RAM, it can be faster to shut everything down and start it again than writing the contents of memory to disk and reading it back. I know that, with a traditional hard drive, my system was in that situation. It's better now that I have a SSD*, but I don't want to be wasting a lot of that (expensive) storage space on a big hibernation file.

*an SSD?
"Optimism, pessimism, fuck that; we're going to make it happen. As God is my bloody witness, I'm hell-bent on making it work." -Elon Musk
Shivahn wrote:I am a motherfucking sorceror.

Axidos
Posts: 167
Joined: Tue Jan 20, 2009 12:02 pm UTC
Location: trapped in a profile factory please send help

Re: What Does Shutdown Do?

Postby Axidos » Thu Sep 02, 2010 9:02 am UTC

PhoenixEnigma wrote:a SSD*

*an SSD?

I'd say a solid state disk and an SSD (since it's "an ess-ess-dee").

keeperofdakeys
Posts: 658
Joined: Wed Oct 01, 2008 6:04 am UTC

Re: What Does Shutdown Do?

Postby keeperofdakeys » Thu Sep 02, 2010 12:55 pm UTC

RThaiRThai wrote:One would think Google would be sufficient, but I tried that and Wikipedia without getting a satisfying answer.

Why does shutting down take the time it does? With Windows it makes sure I save everything before shutting down, but even after that it takes a while. What is wrong with just switching off the power?

It's something I was wondering after reading a Slashdot article.

Back in the days of DOS this was true, because DOS only did one-thing, and the prompt meant 'I'm not doing anything'. The days of multi-tasking operating systems ended this. Programs are always doing things in the background which shouldn't be disturbed.

There is also the fact that data isn't written immediately to your hard drive, it usually hangs round in caches to optimize hard-drive performance. Also modern file-systems use journaling to keep track of files, which write continuously to the disk and they must be unmounted cleanly to work properly. This is different from the days of DOS and FAT, where the disk is not doing anything while a process isn't running (also no journaling meant a full disk scan had to be performed when it was not unmounted cleanly, whereas a journal stops this).

So the moral of the story is to switch to DOS.

User avatar
Josephine
Posts: 2142
Joined: Wed Apr 08, 2009 5:53 am UTC

Re: What Does Shutdown Do?

Postby Josephine » Fri Sep 03, 2010 2:10 am UTC

keeperofdakeys wrote:
So the moral of the story is to switch to DOS.

I never thought I would see this sentence.
Belial wrote:Listen, what I'm saying is that he committed a felony with a zoo animal.


Return to “Computer Science”

Who is online

Users browsing this forum: No registered users and 2 guests