When Windows' Task Scheduler ends as task (either because the task exceeded the stop the task if it runs longer than timeout or because a user right-clicked on it and chose 'End'), what happens behind-the-scenes? Is a WM_CLOSE message sent to the task's executable? Is the OS asked to kill the task?

The fact that a task can be configured to if the running task does not end when requested, force it to stop (Task Properties, Settings tab) makes me think that first Task Scheduler sends a 'hey, I'd like you to close' message (like WM_CLOSE) to the executing task, then, if that message isn't acted on in a timely manner and if the 'force stop' option is configured, the OS is asked to kill the process.

I haven't been able to find documentation on this.


It is handled by the Unified Background Process Manager, however there is no official documentation that I know of that goes in to detail about that processes.

However, if you are willing to accept semi-offical documentation the book Windows Internals has a section about it in the "Management Mechanisms" chapter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.