At 11:59 PM Friday 4/16/99, Sam wrote:
>On Fri, 16 Apr 1999, Mark Delany wrote:
>
>> It wasn't so much the blocking I was thinking of (and I confess
ignorance on 
>> this front) it was on the basis that multiple processes are writing to the 
>> same pipe, thus a 2 byte write could get interspersed with another two byte 
>> write by another process.
>> 
>> But as I say. I have not actually studied the details of the pipe 
>arrangements 
>> between -send and -[lr]spawn, so this may be a complete red herring.
>
>As long as you keep your writes small enough on a POSIX-compliant box,
>they're guaranteed to be atomic, and not split up: 

Erum. But that's what my original response was all about. That conformance 
to this is not universal.

Please read the original response or alternatively have a look at:
ftp://koobera.math.uic.edu/www/docs/unixport.html


Regards.

>
>==============================================================================
>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. 
>==============================================================================
>
>I could not determine the semantics of select(), on this topic.
>
>

Reply via email to