Is HDB locking safe?

John F. Haugh II jfh at rpp386.cactus.org
Fri Aug 17 23:09:16 AEST 1990


In article <YZ85N+6 at xds13.ferranti.com> peter at ficc.ferranti.com (Peter da Silva) writes:
>In article <4024 at rtifs1.UUCP> trt at rti.rti.org (Thomas Truscott) writes:
>> (a) A "sleep(1);" is not enough to avoid a race on a very busy system.
>
>No sleep is ever enough. The system could simply be busier than you ever
>imagined. You don't solve a race problem by narrowing the window: try
>checking the return value of the "unlink": that's the point of failure.

There is a big, fat window between the kill() and the unlink() during
which time the other process and kill() the dead process, unlink() the
stale lock, and creat() the new lock file.  Your process will then
unlink() a lock which has just be created.
-- 
John F. Haugh II                             UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 832-8832                           Domain: jfh at rpp386.cactus.org



More information about the Comp.unix.wizards mailing list