multiple instance on Unix

Grant Edwards grante at visi.com
Thu Sep 30 11:07:25 EDT 2004


On 2004-09-30, Nigel King <nigel.king at orthogonsystems.com> wrote:
>
> On 30 Sep 2004, at 14:11, C Ginger wrote:
>
>> I know the approach to creating a lock file has been around a
>> long time but there are certain weaknesses to it. There are a
>> number of race conditions in it. For instance if process A
>> detects the directory isn't there it will attempt to create
>> it. During that same time process B might also not find it
>> there - since A hasn't completed its create yet.
>
> This was why I created a directory rather than a file since I
> thought this was supposed to be atomic.

AFAIK, creating a file is atomic as well. It's the approach
that's been used by Unix applications for the past 30 years, so
if it wasn't atomic, I would think somebody else would have
noticed the problem and switched to using a lock directory
before now.

-- 
Grant Edwards                   grante             Yow!  I want a WESSON
                                  at               OIL lease!!
                               visi.com            



More information about the Python-list mailing list