Knowledge Base

Named Pipe Buffer Size

PSS ID Number: 105531

Article Last Modified on 12/15/2003


The information in this article applies to:


This article was previously published under Q105531
The documentation for CreateNamedPipe() indicates that

The input and output buffer sizes are advisory. The actual buffer size reserved for each end of the named pipe is either the system default, the system minimum or maximum, or the specified size rounded up to the next allocation boundary.

The buffer size specified should be a reasonable size so that your process will not run out of nonpaged pool, but it should also be large enough to accommodate typical requests.

Every time a named pipe is created, the system creates the inbound and/or outbound buffers using nonpaged pool, which is the physical memory used by the kernel. The number of pipe instances (as well as objects such as threads and processes) that you can create is limited by the available nonpaged pool. Each read or write request requires space in the buffer for the read or write data, plus additional space for the internal data structures.

Whenever a pipe write operation occurs, the system first tries to charge the memory against the pipe write quota. If the remaining pipe write quota is enough to fulfill the request, the write completes immediately.

If the remaining pipe write quota is too small to fulfill the request, the system will try to expand the buffers to accommodate the data using nonpaged pool reserved for the process. The write will block until the data is read from the pipe so that the additional buffer quota can be released. Therefore, if your specified buffer size is too small, the system will grow the buffer as needed, but the downside is that the operation will block. If the operation is overlapped, a system thread is blocked; otherwise, the application thread is blocked.

Additional query words: 3.5 3.51 4.0

Keywords: kbAPI kbIPC kbnetwork kbPipes KB105531
Technology: kbAudDeveloper kbOSWinNT310 kbOSWinNT350 kbOSWinNT351 kbOSWinNT400 kbOSWinNTSearch kbOSWinSearch kbWin32API kbWin32sSearch