system wide mutex

Chris Angelico rosuav at gmail.com
Sun Feb 9 23:09:18 CET 2014


On Mon, Feb 10, 2014 at 1:45 AM, Roy Smith <roy at panix.com> wrote:
> In article <mailman.6578.1391943647.18130.python-list at python.org>,
>  Skip Montanaro <skip at pobox.com> wrote:
>
>> As the author of lockfile, I can tell you it only implements advisory
>> locking. All programs needing to access the locked resources must
>> cooperate.
>
> This is true of all mutexes, no?
>

Not quite all; mandatory locks actually prevent other access. But they
require support from whatever makes the resource available - most
commonly, the file system - where cooperative locking doesn't. I've
written a number of cooperative locking systems in the past (eg to
protect a network resource, when the mounted file system didn't offer
the sort of locking I needed), and they're usually the way to go when
there's anything complicated going on.

What, all mutexes?
Yes, all mutexes!
What, all?
Well.... nearly all!

-- with apologies to WS Gilbert, HMS Pinafore, and the Pirates of Penzance

ChrisA



More information about the Python-list mailing list