public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Hancock <hancockr@shaw.ca>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: any fairness in NTPL pthread mutexes?
Date: Mon, 31 Oct 2005 21:52:47 -0600	[thread overview]
Message-ID: <4366E68F.3040109@shaw.ca> (raw)
In-Reply-To: <53M7O-7Se-33@gated-at.bofh.it>

Christopher Friesen wrote:
> 
> I'm using NPTL.
> 
> If I have a pthread mutex currently owned by a task, and two other tasks 
> try to lock it, when the mutex is unlocked, are there any rules about 
> the order in which the waiting tasks get the mutex (ie priority, FIFO, 
> etc.)?
> 

Not in the pthread spec (at least not for normal SCHED_OTHER tasks), and 
Linux/glibc don't really provide any either. In particular, if one 
thread unlocks a mutex and immediately tries to relock, there is no 
guarantee that any other thread waiting on the mutex will be able to get 
in and lock it before the first thread can relock.

-- 
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/


       reply	other threads:[~2005-11-01  3:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <53M7O-7Se-33@gated-at.bofh.it>
2005-11-01  3:52 ` Robert Hancock [this message]
2005-10-31 17:57 any fairness in NTPL pthread mutexes? Christopher Friesen
2005-10-31 18:06 ` Lee Revell
2005-10-31 22:09   ` Lee Revell
2005-10-31 19:09 ` Joe Seigh
2005-11-02 17:47 ` James Courtier-Dutton
2005-11-02 18:47   ` Lee Revell

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=4366E68F.3040109@shaw.ca \
    --to=hancockr@shaw.ca \
    --cc=linux-kernel@vger.kernel.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