file locking issue

Anders (anders.linden@kurs.perceptive.se)
Tue, 16 Mar 1999 16:49:58 +0100


With both flock and fcntl-file locking (I have only tried with fctnl on
a whole file) this problem occurs:

If the process A gets a shared lock on the file and some process B after
that tries to get an exclusive lock on the file, process B will block.
(So far, so good).

If a third process C tries to get a shared lock on the file (where A
holds a lock and B tries to get one), it will get it.

So process B has to wait for C too.

And if a process D comes in and tries to get a shared lock that is
granted too, B has to wait.

Why is it like that? Cant incoming shared lock tries be queued to honor
B so it doesnt have to wait forever?

What does Posix say? Where can I get that documents?

Best regards
Anders Linden, Sweden

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/