Why does it sometimes take a long time for windows to shutdown?

1

I'm not sure if this is a programming question exactly, but it does affect my work quite a bit. I have a project I'm working on where a program has to perform certain tasks on startup. The project itself is no problem, but testing it is. Windows XP and Vista is taking a long time to shutdown.

When Windows tries to shut down the hard drive sometimes seems to thrash constantly. It can take from 1 to 3 minutes with the windows screen sitting there saying "Shutting down please wait." There is no indication of what is happening and I can't seem to monitor the process because any programs I try to leave running get terminated. Restarts seem to go bit faster.

I've disabled automatic windows updates so that's the problem. I've also ran anti-virus and anti-spyware programs and the system appears to be clean. I generally have a few browser windows open, putty, python and visual studio.

  1. Why does Windows XP/Vista take so long to shutdown sometimes but not all the time?
  2. What exactly happens during the shutdown process?
  3. Is there anything I can do to speed up the shutdown process?

Thank you

Great Turtle

Posted 2009-08-17T20:50:08.457

Reputation:

I'm struggling to see the programming angle here... – skaffman – 2009-08-17T20:51:59.887

Should go on SuperUser probably. – EBGreen – 2009-08-17T20:58:21.340

Re #3, Ivo had a trick in the Windows tweaks thread http://superuser.com/questions/3864/which-windows-tweaks-do-you-use-and-they-actually-work/4976#4976.

– hyperslug – 2009-08-17T21:09:24.873

You can make Windows shutdown faster by changing how long it waits for services and applications to be killed with a few registry tweaks as described in this article.

– martineau – 2012-08-06T19:00:16.983

Answers

6

Windows services takes the most of shutdown time. Some services, like those that have network-related shutdown operations or have to save large amounts of data to disk, might require more time and so Windows Vista allows a service to request pre-shutdown notification. When Windows Vista shuts down, the Service Control Manager first notifies those services asking for pre-shutdown notification. It will wait indefinitely for these services to exit, but if they have a bug and don't respond to queries, the Service Control Manager gives up and moves on after three minutes.

Kirill V. Lyadvinsky

Posted 2009-08-17T20:50:08.457

Reputation: 5 028

2

I'm not sure if you're already doing this, but exiting all programs manually (including any in the systray) before shutting down speeds up the process for me.

jlingerfelt83

Posted 2009-08-17T20:50:08.457

Reputation: 79

0

Windows also saves settings on shutdown. The longer you keep your computer on you will notice it takes longer to shut down.

John T

Posted 2009-08-17T20:50:08.457

Reputation: 149 037

0

Leaving certain programs open can slow shutdown, too. For example, it can take upwards of a minute to shut down if I leave uTorrent (for linux distros, of course) open, but closer to 15 seconds otherwise. It's no exact amounts, but closing off apps that constantly download/upload/disk I/O could help.

Phoshi

Posted 2009-08-17T20:50:08.457

Reputation: 22 001