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

Re: atomically concurrent writes question



On 06/23/2010 12:51 AM, Evuraan wrote:
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?


Not only the kernel, but *bash* (or whatever other lesser shell you use...) is what you'd need to look at to see what it does when it sees ">>".

hope this question make sense.


It does...

--
Seek truth from facts.


Reply to: