6.2.4 Atomic Operations with Pipes Next: 6.2.5 Notes on half-duplex Up: 6.2 Half-duplex UNIX Pipes
Previous: 6.2.3 Pipes the Easy6.2.4 Atomic Operations with PipesIn order for an operation to be considered ``atomic'', it must not be interrupted
for any reason at all. The entire operation occurs at once. The POSIX standard dictates in /usr/include/posix1_lim.h that the maximum buffer size
for an atomic operation on a pipe is: #define _POSIX_PIPE_BUF 512Up to 512 bytes can be written or retrieved from a pipe atomically. Anything
that crosses this threshold will be split, and not atomic. Under Linux, however, the atomic operational limit is defined in ``linux/limits.h'' as: #define PIPE_BUF 4096As you can see, Linux accommodates the minimum number of bytes required by
POSIX, quite considerably I might add. The atomicity of a pipe operation
becomes important when more than one process is involved (FIFOS). For
example, if the number of bytes written to a pipe exceeds the atomic limit
for a single operation, and multiple processes are writing to the pipe,
the data will be ``interleaved'' or ``chunked''. In other words, one process
may insert data into the pipeline between the writes of another.Converted on:Fri Mar 29 14:43:04 EST 1996T
Wyszukiwarka
Podobne podstrony:
node136node132node138node138node132node136 YYN3RGJTIUYB5B7V76SG2CWOJ3Z3Q2BSSAGQGHInode130node138 MPOLWBY7F5JRTBXYS57QFRPMNJNRLEKA6WXG3SAnode136 1node13node134node136 WDIY3HIN7ZG3NQWBCNN3XXBKEQZUQYN6VJDWQNAnode132Node13 Htmnode131więcej podobnych podstron