mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Satyam Sharma" <satyam.sharma@gmail.com>
To: "Robert P. J. Day" <rpjday@mindspring.com>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
	"Florin Iucha" <florin@iucha.net>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: "upping" a semaphore from interrupt context?
Date: Sun, 24 Jun 2007 22:15:48 +0530	[thread overview]
Message-ID: <a781481a0706240945j3a8afe8dkbb6b74d92bdedfc4@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0706241123130.7006@localhost.localdomain>

Hi Robert,

On 6/24/07, Robert P. J. Day <rpjday@mindspring.com> wrote:
> On Sat, 23 Jun 2007, Satyam Sharma wrote:
>
> > On 6/23/07, Robert P. J. Day <rpjday@mindspring.com> wrote:
>
> > > hang on, how is that true?  as i read it, mutexes are more than
> > > just binary semaphores -- they have additional restrictions that
> > > regular semaphores don't.
> >
> > Yes, they do have additional restrictions (mutex_trylock() illegal
> > from contexts that cannot sleep, mutexes may only be unlocked by
> > tasks that took them in the first place). But note that these are
> > _implementation_ sanity checks that were introduced to catch
> > nonsensical usage, which was possible (and not explicitly being
> > guarded against, because of the generic-ness that was needed to be
> > maintained for the counted case too) with the "semaphore"s.
> >
> > > so i'm not convinced that binary semaphores can simply be replaced
> > > by mutexes, unless that's not what you meant here.
> >
> > I do mean precisely that. I really cannot think of any sensible /
> > normal usage case of binary semaphores that cannot be replaced with
> > either mutexes (if that's the kind of locking you actually want) or
> > completion handlers (if that's the kind of synchronization you
> > actually want).
>
> ok, i can see what you're getting at now.  i'm just going to have to
> convince myself that, once you have mutexes and completions, you have
> no further need for even general counting semaphores.

Whoa, hold on. But I've been explicitly mentioning *binary* semaphores
all along!

Of course users who want / allow multiple tasks (but only upto a specific
maximum number, which is what counted semaphores are all about)
to be present in a given critical section simultaneously would still want
to use the _counted_ semaphores, which is why you won't see the old
"struct semaphores" dying anytime soon.

Satyam

  reply	other threads:[~2007-06-24 16:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-22 17:38 Florin Iucha
2007-06-22 17:34 ` Arnd Bergmann
2007-06-23 11:52   ` Robert P. J. Day
2007-06-23 12:02     ` Arnd Bergmann
2007-06-23 12:06       ` Robert P. J. Day
2007-06-23 15:42       ` Satyam Sharma
2007-06-23 15:52         ` Oliver Neukum
2007-06-23 17:02           ` Satyam Sharma
2007-06-23 16:11         ` Robert P. J. Day
2007-06-23 17:16           ` Satyam Sharma
2007-06-24 15:25             ` Robert P. J. Day
2007-06-24 16:45               ` Satyam Sharma [this message]
2007-06-24 16:59                 ` Robert P. J. Day
2007-06-24 18:12                   ` Satyam Sharma
2007-06-22 17:50 ` Satyam Sharma

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=a781481a0706240945j3a8afe8dkbb6b74d92bdedfc4@mail.gmail.com \
    --to=satyam.sharma@gmail.com \
    --cc=arnd@arndb.de \
    --cc=florin@iucha.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpjday@mindspring.com \
    /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

all inboxes | Powered by JetHome®