Online Documentation Server
 ПОИСК
ods.com.ua Web
 КАТЕГОРИИ
Home
Programming
Net technology
Unixes
Security
RFC, HOWTO
Web technology
Data bases
Other docs

 


 ПОДПИСКА

 О КОПИРАЙТАХ
Вся предоставленная на этом сервере информация собрана нами из разных источников. Если Вам кажется, что публикация каких-то документов нарушает чьи-либо авторские права, сообщите нам об этом.




next up previous contents
Next: 6.2.5 Notes on half-duplex Up: 6.2 Half-duplex UNIX Pipes Previous: 6.2.3 Pipes the Easy

6.2.4 Atomic Operations with Pipes

In 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         512

Up 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        4096

As 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 1996


With any suggestions or questions please feel free to contact us