public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Andrew Morton <akpm@digeo.com>
Cc: Matthew Wilcox <willy@debian.org>, linux-kernel@vger.kernel.org
Subject: Re: flock(fd, LOCK_UN) taking 500ms+ ?
Date: Wed, 02 Oct 2002 23:36:46 +0200	[thread overview]
Message-ID: <3D9B66EE.90001@colorfullife.com> (raw)

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




             reply	other threads:[~2002-10-02 21:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-02 21:36 Manfred Spraul [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-10-02  2:39 flock(fd, LOCK_UN) taking 500ms+ ? John Levon
2002-10-02  3:23 ` John Levon
2002-10-02 13:14   ` Matthew Wilcox
2002-10-02 17:04     ` Andrew Morton
2002-10-02 18:30       ` Matthew Wilcox
2002-10-02 18:58         ` John Levon
2002-10-02 19:10           ` Robert Love
2002-10-02 19:21         ` Robert Love
2002-10-02 19:23         ` Andrew Morton
2002-10-02 20:05           ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D9B66EE.90001@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox