[concurrency-interest] A new Lock implementation: FileLock

Dawid Kurzyniec dawidk at mathcs.emory.edu
Tue Aug 30 00:32:49 EDT 2005


Gregg Wonderly wrote:

>>> There's really not an interesting reason to recreate all of that work.
>>>
>> I hope that your point is that distributed file locking is not a 
>> reliable substitute for a transaction manager, be it Jini or 
>> otherwise, when one is needed. If so, I fully agree. On the other 
>> hand, distributed transaction manager is shooting flies from a cannon 
>> if all you need is basic non-distributed inter-process synchronization.
>
>
>
> My point is that a solution already exists. 

Only, to a different problem.

> If you think that you 
> need a same machine, interprocess solution today, chances are that 
> tomorrow you'll need a distributed version.  (...)
>
"If you only have a hammer, everything looks like a nail." Or, a
federation of distributed services, for that matter.

Scenarios where I would use file locking are those where I would
synchronize access to shared files stored in the very same filesystem.
For instance, suppose I am developing an e-mail client that caches
messages in ${user.home}/Mail. Then I need some means of protecting data
from mangling when the user launches two clients simultaneously. The
same goes if I am developing an e-mail server, since the user may open
multiple sessions simultaneously, which can e.g. move/delete files on
the server. Or, suppose I want to make sure that only a single instance
of an executable can be running on a host (e.g. if it is a system-level
service). These are well-known (for decades) and legit use cases for
file locking, in which I would be out of my mind to deploy a distributed
transaction manager.

The bottom line is that EVERY technology, be it a hammer, Jini, or file
locking, has its domain of applicability. Claiming that one technology
can solve all world's problems is naive. At least, stick to the issue at
hand, and confine yourself to precise, technical, non-vague,
non-hypothetical, non-tutoring, non-red-herring and non-philosophical
arguments.

Regards,
Dawid






More information about the Concurrency-interest mailing list