Understanding Windows Services


The Windows operating system provides a set of services that enable device manufacturers and software vendors to integrate their products with the operating system. These services include

  • Kernel Services The kernel is the core part of the operating system responsible for process, thread, and memory management. Kernel services enable devices and applications to interact with the kernel and use its functionality.

  • Device Driver Services A device driver controls and manages the hardware devices on the computer. Device driver services enable applications to work with devices.

  • Windows Services Windows services enable operating system components and application programs to expose their functionality to other applications.


Windows Service Application A Windows service application is a normal executable file (with a .exe extension) that contains the code for one or more Windows services.

Support for Windows Services Windows services are available on the Windows NT (where they are known as NT services), Windows 2000, Windows XP, and Windows .NET Server operating systems. There is no support for Windows services on the Windows 95, Windows 98, or Windows ME operating systems.

Kernel services and device driver services are mostly used by system programmers. As an application programmer, you'll be more interested in Windows services; therefore, Windows services are the focus of this chapter and the 70-310 Exam.

So, what exactly is a Windows service? Precisely defined, a Windows service is a process that conforms to the interface rules of the Windows Service Control Manager (SCM). The SCM is a part of Windows operating system that provides a unified way to control, configure, and access Windows services.

In general, a Windows service is a process that provides background services to other processes. Some typical examples of Windows service are World Wide Web Publishing, Print Spooler, Task Scheduler, Event Log, Plug and Play, and so on. Some common characteristics of Windows services include

  • Conformance to Service Control Manager Interface Each Windows service must implement a set of well-known methods, which enable the service to communicate with the Service Control Manager. These well-known methods define how a Windows service should handle the SCM messages. Some common messages sent by SCM to a service are Start, Pause, Continue, and Stop. How these messages are handled depends totally on the service; not all Windows services accept all messages. For example, the Event Log and Plug and Play Windows services do not accept Pause and Stop messages and therefore cannot be paused or stopped. The Print Spooler Windows service can be started or stopped but cannot be paused.

  • Lack of User Interface Although Windows services can interact with the desktop and provide a user interface, most services don't. Windows services perform system tasks that usually do not require any user interface. As an example, the job of IIS (Internet Information Services) is to serve the requested Web pages. For accomplishing this job, IIS does not require any user interface or desktop interaction. IIS is launched when a computer is started, and its process remains unseen by a Windows desktop user.


    Communication via Event Log Windows services run in the background and generally do not provide a user interface. However, a Windows service might need to inform the user about an application state or an event in the environment. Most Windows services do so by writing informative messages in the event log.

  • Long-lived Process Typically a Windows service is started automatically when the computer is started and continues to run as long as the operating system is running. Services can execute even when no user is logged on to the system. Most Windows services provide functionality that enables them to be paused, resumed, started, or stopped.

  • Specific User Identity Most Windows services run with System privileges. System is a special account that Windows uses to perform privileged operations. However, each Windows service can be launched with a specific user identity. This feature can restrict services to the permissions defined for an individual user. Consider a scenario in which an administrator requires that a Windows service should only have access to a limited set of directories on a file system. The administrator can easily accomplish this by following these two steps:

    1. Set up a user account with the set of permissions that the administrator wants the service to have.

    2. Configure the Windows service to run with the user identity of the user created in step 1.


    Currently Logged-On User Most Windows services are started before a user logs on, and they keep on running across multiple user sessions. Therefore, the functionality of a Windows service cannot depend on the permissions available to the currently logged on user. A Windows service always executes using an assigned user identity that might be the same or different from the currently logged on user.

  • Separate Windows Process A Windows service does not run in the process of the program that communicates with it. Instead, a Windows service runs in its own process. Sometimes, a Windows service can also share a process with another Windows service.

  • Special Installation Procedure Unlike a Windows application, a Windows service cannot be started by just clicking on its EXE file. Instead, a Windows service requires a special installation procedure. This installation procedure registers the Windows service with the Windows Service Control Manager (SCM).


MCAD. MCSD Training Guide (Exam 70-310. Developing XML Web Services and Server Components with Visual Basic. NET and the. NET Framework)
MCAD/MCSD Training Guide (70-310): Developing XML Web Services and Server Components with Visual Basic(R) .NET and the .NET Framework
ISBN: 0789728206
EAN: 2147483647
Year: 2002
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net