Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.074 X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; 'url:pypi': 0.03; 'implements': 0.09; 'cc:addr:python-list': 0.11; '"system': 0.16; 'fixing.': 0.16; 'flavors': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; '(you': 0.16; 'sender:addr:gmail.com': 0.17; 'written': 0.21; 'cc:addr:python.org': 0.22; 'skip': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'file': 0.32; 'languages': 0.32; 'url:python': 0.33; 'bugs': 0.33; 'beyond': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'url:org': 0.36; 'that,': 0.38; 'reported': 0.39; 'enough': 0.39; 'most': 0.60; 'tell': 0.60; 'identify': 0.61; 'face': 0.64; 'needing': 0.65; 'to:addr:gmail.com': 0.65; 'url:0': 0.67; 'advisory': 0.84; 'atomic': 0.84; 'locked': 0.84; 'nfs': 0.84; 'subject:system': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=ZyT3+GKqUv2QFnnA/wXSZokyHD9TjcThfYlWTXKq7D0=; b=EWC63wOFR65t3FV7nLvTSV4MEzE1s6uMf+YUZ4plZTGeACiyiXZeT411mqfCnRO2s7 VQUzbhrjnKG/pOtL5BUvM9Tp/VCD+M/pOS/fy8qGqG0wN//A7drOXw0+//NicS+/WfCt 5oOzTdjM5wnkgYe5CfcZcPBIXZc0nrzrE9ZoeG/7YJOgi9r4RrN3oFEQfFeO4acKophG xRd4u7DXLvHZ1G2c1msIOcpq8KYvmzw9+899NA5OCUizeQpChms/MeOCN6kN2oc7SMI7 bshGGYwM1ebD5mU7FGNTeYMUUsosh86QcDfIO9bD7duKhUctQvVAMnZ9jjRohvJKFlPO 7S6Q== MIME-Version: 1.0 X-Received: by 10.221.40.10 with SMTP id to10mr1233985vcb.22.1391943639935; Sun, 09 Feb 2014 03:00:39 -0800 (PST) Sender: skip.montanaro@gmail.com In-Reply-To: References: Date: Sun, 9 Feb 2014 05:00:39 -0600 X-Google-Sender-Auth: z0un34v6qQEEP7Pbcs0e4D4sNHw Subject: Re: system wide mutex From: Skip Montanaro To: Asaf Las Content-Type: text/plain; charset=UTF-8 Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391943647 news.xs4all.nl 2913 [2001:888:2000:d::a6]:50833 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65740 > Which one is most recommended to use for mutex alike locking to > achieve atomic access to single resource: > > - fcntl.lockf > - os.open() with O_SHLOCK and O_EXLOCK > - https://pypi.python.org/pypi/lockfile/0.9.1 > - https://pypi.python.org/pypi/zc.lockfile/1.1.0 > - any other ? As the author of lockfile, I can tell you it only implements advisory locking. All programs needing to access the locked resources must cooperate. It also has bugs which have been reported which I have yet to spend any time fixing. Beyond that, your question isn't really detailed enough to answer completely. You don't identify what sort of systems you need this to work on (Windows, Mac, various flavors of Unix?), whether programs written in other languages will be involved (you did say "system wide"), and whether you need to use it in the face of network file systems like NFS or Samba. Skip