What happens once an user click shutdown button

when an user clicks shutdown button, what OS does

1. will it stop all the process running in the background right away and spend time in closing those?

2. apps (exe) which were running won't be having any control and it is fully operating system which does everything to kill all the running processes right?

3. What is the exact flow that OS follows to kill apps when shutdown button is pressed.?

February 11th, 2015 8:16am

After you press shutdown button :
1. PC will alert you if you really want to shutdown "Do you really want to shut down? Those users may be running programs or have unsaved documents"
2. Programs will close, also will prompt you if there is any unsaved data
3. User log out
4. All programs, service, and processes will be end
5. Shutdown signal send to computer power managment
"It is now safe to turn off this computer and get back to real life"

  • Edited by britishdhez Wednesday, February 11, 2015 5:41 AM
Free Windows Admin Tool Kit Click here and download it now
February 11th, 2015 8:41am

After you press shutdown button :
1. PC will alert you if you really want to shutdown "Do you really want to shut down? Those users may be running programs or have unsaved documents"
2. Programs will close, also will prompt you if there is any unsaved data
3. User log out
4. All programs, service, and processes will be end
5. Shutdown signal send to computer power managment
"It is now safe to turn off this computer and get back to real life"

  • Edited by britishdhez Wednesday, February 11, 2015 5:41 AM
February 11th, 2015 8:41am

apps (exe) which were running won't be having any control and it is fully operating system which does everything to kill all the running processes right?

I don't think so but haven't checked the implementation recently for W8.  A long time ago (e.g. NT4) there used to be a registry value we could set which would at least give tasks so many milliseconds to cleanup.  I'm not sure how we could check if that value is still being used.  I think ProcMon has an option which lets you record to disk instead of virtual memory, so perhaps if you just started it up with that you could later find out how far it got.  OTOH you would have to hope that ProcMon was not one of the first tasks to be aborted.   <eg>

I'm not sure if this is the value that I was trying to recollect.

http://support2.microsoft.com/kb/305788/en-us

   

(via BING search for
shutdown task cleanup registry milliseconds
)

<quote>

 The default time-out value (20 seconds) is stored in the WaitToKillAppTimeout value in the following registry key:

HKEY_CURRENT_USER\Control Panel\Desktop

This value is expressed in milliseconds.

</quote>

FYI

Free Windows Admin Tool Kit Click here and download it now
February 11th, 2015 1:44pm

thanks robert.

The kb which you have shared is for xp, do we have similar one for win8.1 ?

can we get the flow of shutdown.. ( what OS says to process that are running when user confirms shutdown? How time is given to dependent apps? lets says we have app2 dependent on app1, what is the flow that os follows to close app1 and ensures no data loss and proper shutdown)

Also, if OS gives 20sec in Win8.1 too, then the shutdown time shown for each process in ADK test incldes these 20sec or will ADK start timer after these 20 sec. 

How ADK test sets 300ms as benchmark for graphics exes? (what is the criteria ?)

February 11th, 2015 11:31pm

somewhere it was written;

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control]
"WaitToKillServiceTimeout"="5000"

Free Windows Admin Tool Kit Click here and download it now
February 12th, 2015 12:10am

what is unit for 5000?

what happens if the service couldn't able to do clean up in the given time?

can we get the flow of shutdown.. ( what OS says to process that are running when user confirms shutdown? How time is given to dependent apps? lets says we have app2 dependent on app1, what is the flow that os follows to close app1 and ensures no data loss and proper shutdown)

February 12th, 2015 2:35am

thanks robert.

The kb which you have shared is for xp, do we have similar one for win8.1 ?

can we get the flow of shutdown.. ( what OS says to process that are running when user confirms shutdown? How time is given to dependent apps? lets says we have app2 dependent on app1, what is the flow that os follows to close app1 and ensures no data loss and proper shutdown)

Also, if OS gives 20sec in Win8.1 too, then the shutdown time shown for each process in ADK test incldes these 20sec or will ADK start timer after these 20 sec. 

How ADK test sets 300ms as benchmark for graphics exes? (what is the criteria ?)

  • Edited by Sarath_dnv Thursday, February 12, 2015 4:29 AM
Free Windows Admin Tool Kit Click here and download it now
February 12th, 2015 7:26am

thanks robert.

The kb which you have shared is for xp, do we have similar one for win8.1 ?

can we get the flow of shutdown.. ( what OS says to process that are running when user confirms shutdown? How time is given to dependent apps? lets says we have app2 dependent on app1, what is the flow that os follows to close app1 and ensures no data loss and proper shutdown)

Also, if OS gives 20sec in Win8.1 too, then the shutdown time shown for each process in ADK test incldes these 20sec or will ADK start timer after these 20 sec. 

How ADK test sets 300ms as benchmark for graphics exes? (what is the criteria ?)

  • Edited by Sarath_dnv Thursday, February 12, 2015 4:29 AM
February 12th, 2015 7:26am

what is unit for 5000?

what happens if the service couldn't able to do clean up in the given time?

can we get the flow of shutdown.. ( what OS says to process that are running when user confirms shutdown? How much time is given to dependent apps for shutdown?  say we have app2 dependent on app1, what is the flow that os follows to close app1 and ensures no data loss and proper shutdown is done.


  • Edited by Sarath_dnv Tuesday, February 17, 2015 6:14 AM typo
Free Windows Admin Tool Kit Click here and download it now
February 12th, 2015 10:30am

Hello Sarath_dnv,

About the Windows Shutdown details, please take a look at the following article.
http://blogs.msdn.com/b/b8/archive/2011/09/08/delivering-fast-boot-times-in-windows-8.aspx

1. The user initiates a shutdown by selecting shut down from the Start menu, or by pressing the power button; or an application initiates shutdown by calling an API such as ExitWindowsEx() or InitiateShutdown().
2. Windows broadcasts messages to running applications, giving them a chance to save data and settings. Applications can also request a little extra time to finish what theyre doing.
3. Windows closes the user sessions for each logged on user.
4. Windows sends messages to services notifying them that a shutdown has begun, and subsequently shuts them down. It shuts down ordered services that have a dependency serially, and the rest in parallel. If a service doesnt respond, it is shut down forcefully.
5. Windows broadcasts messages to devices, signaling them to shut down.
6. Windows closes the system session (also known as session 0).
7. Windows flushes any pending data to the system drive to ensure it is saved completely.
8. Windows sends a signal via the ACPI interface to the system to power down the PC.

Best regards,
Fangzhou CHEN

February 18th, 2015 9:50pm

thanks for the reply Fangzhou CHEN.

2. Windows broadcasts messages to running applications, giving them a chance to save data and settings. Applications can also request a little extra time to finish what theyre doing. 

How much time is given to each process to save data and settings? What if the apps don't need anytime and get closed as soon as it gets shutdown interrupt?

Could you explain how it works in this situation

say we have app2 dependent on app1, what is the flow that os follows to close app1 and ensures no data loss and proper shutdown is done.


Free Windows Admin Tool Kit Click here and download it now
February 24th, 2015 12:24am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics