How (behind-the-scenes) does Task Scheduler end tasks?

4

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.

Ben Gribaudo

Posted 2015-09-25T20:10:02.490

Reputation: 235

Answers

1

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.

Scott Chamberlain

Posted 2015-09-25T20:10:02.490

Reputation: 28 923