E. Crane Computing
E. Crane Computing                                                                                                                           Log In to Support Forum

 PBService Concepts


Windows NT System Architecture

There are three components to the Windows NT Service Architecture:

  • The Service Control Manager (SCM) is included with Windows NT and provides a unified and secure means of controlling services. It communicates with services, telling them to stop, start, pause, continue, and so on.
  • The Service, which is an application that receives commands from the SCM. The commands cause the Service to either change between well-defined states or to perform some action. Also, the Service periodically reports its status to the SCM so that an SCP can monitor its operation.
  • The Service Control Program (SCP) is an application that talks through the SCM to manage Services. The SCP adds, removes, and alters the configuration of Services in the SCM Database. Additionally, the SCP sends commands to Services and queries Services' states.

PBService adds a fourth component, Event Logging, to the service architecture. The event log provides remote monitoring of the service's historical operation.

Service Anatomy

The internals of a Service also contain three basic parts: the Service Process, the Service Handler, and the Service Main.

Service Process
The service process is the executable program (EXE) for the program. It is responsible for overall process initialization and registering its services with the SCM.

Service Main
The Service Main does all the real work for the service. It maintains an internal state that corresponds to the various commands it receives from the SCM. As the Service Main goes through the process of changing states, it sends status information to the SCM.

Service Handler
The Service Handler receives commands from the SCM and simply dispatches them to the Service Main.

All of the above components must do their respective tasks in a timely manner. The SCM monitors the progress of the service's state transitions. If a component fails to report promptly to the SCM, the SCM considers the service hung and in some cases terminates the service. To help ensure that the service remains responsive, the SCM runs the Service Main on a separate thread.

Multiple Service Main Instances
The Windows NT Service Architecture supports multiple Service Main instances per Service Process. This allows related services to efficiently share a process virtual memory space and other system resources. Currently, PBService only supports a single Service Main per Service Process.