Unix Programming - Re: Concurrent Updates of the Same File by 2 Instances of the Same

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > February 2006 > Re: Concurrent Updates of the Same File by 2 Instances of the Same





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Concurrent Updates of the Same File by 2 Instances of the Same
Ralf Fassel

2006-02-17, 10:40 pm

* "John Smith" <wleung7@gmail.com>
| if i use a lockfile, i can only restrict access to the file by
| terminating the S2. How do I make S2 "busy-wait" for S1 to finish
| such that S1 and S2 are serialized?

procmail (http://www.procmail.org/) has a 'lockfile' binary which
creates the lockfile in an atomic fashion. Probably the OS has
something like that?

If you use a non-atomic wait a la
while test -f lockfile ; do
sleep 1
done
touch lockfile
you will get bitten by the race condition sooner or later.

R'
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com