Re:Appending to a file from multiple processes
by pjc50 on Thursday August 04, 2016 @07:01AM
(#12224700)
The classic application from appending from multiple sources while potentially modifying a file and potentially having NFS in the way is a mail spool using mbox.
While there are various hard-won implementations that work doing this, it's also one of the reasons maildir was invented.
It's much more portable, comprehensible, and reliable to have a single process writing to the file and all the other producers sending records to it using sockets or named pipes. The consolidator needs to be aware of record boundaries so you don't have to worry about pipe atomicity.
While there are various hard-won implementations that work doing this, it's also one of the reasons maildir was invented.
It's much more portable, comprehensible, and reliable to have a single process writing to the file and all the other producers sending records to it using sockets or named pipes. The consolidator needs to be aware of record boundaries so you don't have to worry about pipe atomicity.