[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

atomically concurrent writes question



I've a script which forks and echo's [appends] multiple long lines to
one plain text file.  some of the multiple threads also yank lines
from the same plain text file. this file is now approx 31M and has
about 105000 lines ( growing.)   i've been doing this for years now,
and have seen nothing go wrong so far. (yay!)


my question is rather theoretical - what can go wrong if multiple
processes are writing to the same file at multiple instances?

i've read elsewhere, that the kernel takes care of this stuff. or is
it that i could just not cause finitely concurrent writes to the file
and have not seen a corrupt line just by luck?

hope this question make sense.

many thanks in advance.


Reply to: