lkml.org 
[lkml]   [2002]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: flock(fd, LOCK_UN) taking 500ms+ ?
akpm wrote:
> It's not really clear why that yield is in there at all? Unless that
> code is really, really slow (milliseconds) then probably it should just
> be deleted.
>
It looks like a very simple starvation control:

thread 1:
for(;;) {
F_LOCK
<do a few seconds work>
F_UNLCK
}
thread 2:
F_LOCK.

If there is no yield after unlock, thread 2 might never receive the lock.
Is it possible to figure out if someone is waiting on the lock? F_UNLCK
should schedule, if there is a waiter with higher priority.

--
Manfred



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

\
 
 \ /
  Last update: 2005-03-22 13:29    [W:0.103 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site