As part of my Uni course we've been shown and asked to use pipes to communicate between processes (using pipe()
and fork()
) for a few small exercises. No problems getting it to work or with the concept, but outside of these requirements I'm wondering how efficient it is to write and read with a pipe of this type?
If I've some value that I'm packing in to a block of 4 bytes, is it better to pack and write 100 values (so 400 bytes) all at once?
Or is the performance comparable if I do 100 writes each of 4 bytes?
Does piping 400 bytes in one go prevent the reciever doing anything until the write is complete - assuming the reciever is only trying to read the first 4 bytes, will it be able to do so after they're written, but before all 400 is finished?