Windows Services and SCM Improvements in Windows 7


Windows Services are designed to run as noninteractive system processes in the background. Services respond to application and user requests and manage devices or other system resources. Specifically, a Windows service is an application that is implemented by using the Windows Services programming model. Windows 7 supports the ability to start or stop a service when specific event triggers occur. The OS also includes significant improvements to the SCM.

Types of Windows Service Startup:

  1. Automatic specifies that a service should be started immediately after the system has completed starting the operating system.
  2. Automatic (Delayed Start) specifies that a service should be started approximately 2 minutes after the system has completed starting the operating system.
  3. Manual specifies that a service can be started at any time during regular system operation or whenever a dependent service is started. In Windows 7 supports the ability to start or stop a service when specific event triggers occur., such as the addition of a particular hardware device.

SCM Improvements in Windows 7:

The Windows 7 operating system includes significant improvements to the SCM. These improvements are designed to allow services to be started only when they are required and to help reduce the number of services that use Automatic Start. To realize the vision of having services run only when they are absolutely required, the Windows SCM infrastructure was improved in Windows 7.

Service developers should be aware of these improvements so that they can design their services to start on demand. The following section describes the improvements to the Windows SCM infrastructure for starting services only when they are required and provides guidance for developers on how to take advantage of these improvements to optimize the efficiency of their services.

The improvements in Windows 7 are designed to enable:

  1. Demand Start of a service when a specific event occurs. A service can register to be started or stopped on a supported event. These events are known as triggers. Starting a service that is based on a trigger is called a Trigger Start.
  2. Demand Start of a service by using SCM client API or COM service activation. A service can also be started on demand by calling an SCM client API function or by COM service activation when a client application requires functionality that is provided by the service. The infrastructure that supports this functionality was improved in Windows 7.
  3. Stopping a service when idle: A service can stop itself if it determines that it is not servicing any clients or performing any other activity for a specified amount of time.

Command Line Utility (Sc.exe):

Windows includes a command-line utility, Sc.exe is the SCM command-line tool in Windows that lets you create, delete, start, or stop a service, as well as query or modify the configuration of a service.

You can use the command “sc qtriggerinfo” to view service triggers.

Note: Moving to Demand Start or Trigger Start may not be appropriate for all services. For example, a service that requires activity during most of the system’s uptime or that has a high frequency of intermittent activity should not move to a Demand Start or Trigger Start model. In these situations, it is appropriate to use Automatic Start.

References: