Talk:File locking

Incoherent
This is the most incoherent article ever written, incomplete, disorganized, throws around technical terms without referencing them.... If a computer engineer like me can't make any sense of it, somebody should re-write it. — Preceding unsigned comment added by 50.72.73.255 (talk) 10:56, 27 May 2011 (UTC)

Possibility of deadlock in Windows
The article should probably address the possibility of deadlock in windows due to poor application design. I imagine that applications who are locking too many files may interfer with other programs by preventing them access to files at startup. This problem, which probably can be called downsides of madatory locking, should be addressed by someone which knows the subject, and magnitude of the problem. --Fredrik Orderud 02:38, 6 August 2005 (UTC)

Applications hav the option of waiting for a file lock. They jenerally terminate, and if they don't, then of course there's TaskMan (CTRL-ALT-DELETE). I don't remember any occasion where the deadlock (if a terminated process can be called that) wasn't my error. Usually, I'm using sox to write a file that Nero's WaveEdit has open. It's usually an operator error to open the same file with two processes. Deadlock is possible, but unlikely and remediable. BrewJay (talk) 10:15, 14 July 2008 (UTC)

Intro wrong
" Most operating systems support the concept of record locking, " plain wrong, OS do not know about records, they know ONLY about files. Record locking is done by databases, which are applications. OS may support byte range locks on files, though.

UNIX section
Much of the information in the UNIX section was not only irrelevant but false.


 * irrelevant: the ability to create files with of without O_TRUNC or to delete a file and replace it with another has nothing to do with file locking. I will try to reinsert some of this material someplace else, such as under Inode.
 * false: it is not true that typical programs delete and recreate files when writing them. The specific example given is a C compiler. Not gcc nor other compilers that I have used do this. If they did then the user might lose a lot of metainformation such as owner/group information and modes when saving documents in a typical application!

--Celada 23:45, August 25, 2005 (UTC)


 * Great work! The UNIX section was in great need of a proper cleanup. --Fredrik Orderud 01:04, 26 August 2005 (UTC)

Why redirect from "List of software for accessing open files"
I don't understand why a 'list' redirects to the File Locking topic. If this topic does not exist it should be an edit link, rather than redirecting incorrectly. --140.168.69.166 23:27, 12 February 2006 (UTC)


 * Lists hav the lowest priority on wikipedia WP:NOT, and categories duplicate their purpose. All of the computing languages (4) and operating systems (3) I know support opening a file in a particular mode, so that's likely to be a very long and incomprehensive list. BrewJay (talk) 11:37, 15 July 2008 (UTC)

Shouldn't byte range locking be mentioned for the Windows platform?
For Unix locking, it is mentioned that "different kinds of locks may be applied to different sections (byte ranges) of a file". This is not mentioned for the Windows platform.

However, when I checkout the LockFile function in msdn, it seems to me that this is also possible on the windows platform, though only for "server" editions of the OS. I'm not a file-locking specialist, so I'm hesitating a bit to edit the article... --Sandb 16:21, 20 February 2006 (UTC)

The article now mentions LockFile and LockFileEx (which I don't think is limited to server editions of Windows). Guy Harris (talk) 17:07, 1 May 2012 (UTC)

Possible merge with "Shared read lock" article?
Should the information in Shared read lock be incorporated into this article? If not, see my question on the Shared read lock discussion page. UnleashTheWolves 10:16, 1 November 2007 (UTC)


 * Yes. Please put #redirectfile locking into the top of that page when your sure that this article incorporates all information from that one. BrewJay (talk) 12:09, 15 July 2008 (UTC)

Java section
It would make sense to mention something like the FileLock class in Java considering that Java code runs on many operating systems. —Preceding unsigned comment added by 211.29.157.189 (talk) 23:40, 18 February 2009 (UTC)

Here's a Sun discussion page about the topic in Java: Sun Page —Preceding unsigned comment added by 211.29.157.189 (talk) 23:42, 18 February 2009 (UTC)

Lock file
Lock file redirects to this page, but this page is about a different, though related topic. Lock files are, to put it very simply: MaHuJa (talk) 16:46, 5 October 2010 (UTC)
 * if this file exists, do not proceed, something is already working on this fileset.
 * else create it, do your work, and delete it.

Simple but clever locking/unlocking (also handles locks of processes that have been terminated unexpectedly)
Here a part of my linux shell scripts. In addition to normal lock files, the id of the process the lock file is for is written in it. The script should be included by a script that needs locking. So there is no need to manually remove locks that are not used anymore (e.g. when the process has been terminated unexpected). As parameter these functions take a process alias that should be unique and without special characters nor spaces (it will be taken for the lock filename). Hopefully someone will find it useful: