Local Procedure Call

From Wikipedia, the free encyclopedia

The local procedure call (LPC) facility is a service provided by the Microsoft Windows NT kernel for light weight message queue between processes on the same computer. The LPC interface is part of Windows NT's undocumented Native API, although it can be used indirectly in applications via the documented remote procedure call system using the NCALRPC transport (which is implemented by LPC).

Contents

[edit] Implementation

LPC is implemented using kernel "port" objects. A server process first creates a port object with a well known name, and waits for clients to connect. A client process then connects by opening that port and sending a connect message. If the server accepts the connection, a new unnamed port object is created for the connection. Port objects are securable kernel objects that allow a process to identify the process on the other side of the connection.

For short messages (fewer than 304 bytes) the kernel copies the message buffers between processes. Longer messages require the creation of a shared memory section to transfer data, which the LPC service maps between the processes instead.

A related method of inter-process communication known as "Quick LPC" uses shared memory for data transfer and special event pair objects for synchronization. Event pairs allow the called thread to continue the current quantum, reducing scheduling overhead and latency. A standard port object (or some other IPC mechanism) is needed for initial communication.

[edit] Known usage

LPC is used heavily in communication between internal subsystems in Windows NT. The Win32 subsystem used LPC heavily for communication between client and the subsystem server (CSRSS) [1]. Quick LPC was introduced in version 3.51 of Windows NT to make these calls faster. This method was largely abandoned in version 4.0 in favor of moving the performance critical server portions into kernel mode (win32k.sys).

The Local Security Authority Subsystem Service (LSASS), Session Manager (SMSS) [2], and Service Control Manager all use LPC ports directly to communicate with client processes.

Microsoft RPC can use LPC as a transport when the client and server are both on the same machine. Many services that are designed to communicate only on the local computer use LPC as the only transport through RPC. The implementation of remote OLE and DCOM in many cases uses LPC for local communication as well.

[edit] References

[edit] External Links