September 2007 - Posts

Windows with C++: Task Scheduler 2.0

The October 2007 issue of MSDN Magazine is out and features the next article for my Windows with C++ column. In this instalment I introduce the new Task Scheduler API that provides a welcome upgrade to the antiquated scheduling engine found in older versions of Windows (prior to Windows Vista).

Windows with C++: Task Scheduler 2.0


Task Scheduler received a complete overhaul in Windows Vista®. Although there are some similarities, the new Task Scheduler (dubbed Task Scheduler 2.0) is far more powerful than the original, which has been around since Windows® 98. It is no longer just a simple tool for end users, but a powerful platform for designing and managing complex background operations—so much so that it can remove the need for Windows service development in many cases.

Imagine your project needs to check for updates automatically. You might think to write a Windows service that runs in the background and checks for updates every few days. Instead of a service that has to run all the time, you can design a scheduled task that only runs every few days, checks for updates, and then stops. Even better, you can ensure that it runs only when a user is logged in so that resources aren't needlessly consumed when no one is around to perform an update.

It is evident that Microsoft developers consider the new Task Scheduler ready for prime time by the simple fact that it is used by many parts of Windows Vista to manage background tasks. This has the added benefit of reducing the number of new services that would inevitably have been created to handle all those tasks. It also simplifies Windows administration and diagnostics since it is far simpler to interrogate a task to see what it's doing than it is to figure out what a black-box Window service is up to. For tasks that form part of Windows itself, the Task Scheduler also acts as a task host, consolidating many task-specific processes into one and thereby further reducing the resources that are required to host those operations.

In this column I am going to explore the main concepts and building blocks that make up the Task Scheduler so you can get up to speed as quickly as possible and start benefiting from this great new service right away.

Enjoy!

If you’re looking for one of my previous articles here is a complete list of them for you to browse through.

© 2007 Kenny Kerr

Posted by KennyKerr with 1 comment(s)

Contact

This is just a quick note to say that my web hosting provider decided that now would be a great time to shut down all my services and move them to a new server without notice. As a result, all my domains including Window Clippings have been down for days. I have also not received any email this week as it is routed through the domains.

Hopefully it has not caused you as much grief as it has caused me. It may be another week or two before everything is back up again. In the mean time, if you need to contact me for any reason, whether personally or with regard to Window Clippings, feel free to email me directly at kennykerr@gmail.com.

We still don't have Internet access so it may still take me a few days to respond.

Posted by KennyKerr with 3 comment(s)
Filed under:
More Posts