You are not logged in.
hi all
given 4 processes which use flock() with exclusive lock in the following time order
p1: flock -> locked
p2: flock -> blocking
p3: flock -> blocking
p4: flock -> blocking
when p1 releases the lock
which process is the next to get the lock?
will it be p2 then p3 then p4 or is there a more complex rule in the kernel?
btw: maybe someone can point me to the kernel code for such lock's
thx
Offline
Look at "fs/locks.c" in your local kernel source... It sounds like Linux tries to wake
the blocked lockers in the order they locked, though it's not required by any standard:
/* Insert waiter into blocker's block list.
* We use a circular list so that processes can be easily woken up in
* the order they blocked. The documentation doesn't require this but
* it seems like the reasonable thing to do.
*/
Offline