Applications and environment subsystems have a client-server relationship. That is, the client (an application) makes calls to the environment server (a subsystem) to satisfy a request for some type of system services. To allow for a client-server relationship between applications and environment subsystems, Windows NT provides a communication mechanism between them. The Executive implements a message-passing facility called a Local Procedure Call (LPC) facility. It works very much like the Remote Procedure Call (RPC) facility used for networked processing (described in Chapter 1, "Windows NT Networking Architecture," in the Networking Guide). However, the LPC facility is optimized for two processes running on the same computer.
Applications communicate with environment subsystems by passing messages via the LPC facility. The message-passing process is hidden from the client applications by function stubs (nonexecutable placeholders used by calls from the server environment) provided in the form of special dynamic-link libraries (DLLs), as illustrated by Figure 1.5.
Figure 1.5 Interaction with the Local Procedure Call Facility
When an application makes an application program interface (API) call to an environment subsystem, the stub in the client (application) process packages the parameters for the call and sends them to a server (subsystem) process that implements the call. It is the LPC facility that allows the stub procedure to pass the data to the server process and wait for a response.
For example, consider how this process works in the Win32 subsystem. When a Win32 application is loaded to run, it is linked to a DLL that contains stubs for all of the functions in Win32 API. When the application calls a Win32 function (in this example, the CreateWindow Win32 function) the call is processed as follows:
From the application's perspective, the CreateWindow() function in the DLL created the window. The application does not know that the work was actually performed by the Win32 server process (the Win32 subsystem), that a message was sent to make it happen, or even that the Win32 server process exists. It does not know that the subsystem called one or more Executive system servers to support its call to CreateWindow.