public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] different proposal for mq_notify(SIGEV_THREAD)
Date: Wed, 10 Mar 2004 20:38:57 +0000	[thread overview]
Message-ID: <20040310203857.GA7341@mail.shareable.org> (raw)
In-Reply-To: <404B2C46.90709@colorfullife.com>

Manfred Spraul wrote:
> Problem:
> - high resource usage: one fd for each pending notification.
> - complex user space.
> 
> New proposal:
> mq_notify(SIGEV_THREAD) receives two additional parameters:
> - a 16-byte cookie.
> - a file descriptor of a special notify file. The notify file is similar 
> to a pipe. The main difference is that writing to it mustn't block, 
> therefore the buffer handling differs.
> If the event happens, then the kernel "writes" the cookie to the notify 
> file.
> User space reads the cookie and calls the notification function.
> 
> Problems:
> - More complexity in kernel.
> - How should the notify fd be created? Right now it's mq_notify with 
> magic parameters, probably a char device in /dev is the better approach.

Wouldn't it make more sense to use epoll for this?

At the moment, async futexes use one fd per futex, and you want to
wait for multiple ones you have to use select, poll or epoll.

If you want to collect from multiple event sources through a single
fd, you can use epoll.  That seems remarkeably similar to what you're
proposing for mq_notify().

The difference is that your proposal eliminates those fds.
But there is no reason that I can see why mq_notify() should be
optimised in this way and futexes not.

If you have a cookie mechanism especially for mq events, why not for
futexes, aio completions, timers, signals (especially child
terminations) and dnotify events as well?

> I think that the added complexity is not worth the effort if the notify 
> fd is only used for posix message queues. Are there other users that 
> could use the notify file? How is SIGEV_THREAD implemented for aio and 
> timers?

Presently, futexes, aio completions, timers, signals and dnotify
events could all usefully use a notify file.  Not just for
SIGEV_THREAD, either.

-- Jamie

  reply	other threads:[~2004-03-10 20:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-07 14:05 [RFC] different proposal for mq_notify(SIGEV_THREAD) Manfred Spraul
2004-03-10 20:38 ` Jamie Lokier [this message]
2004-03-10 20:57   ` Manfred Spraul
2004-03-10 21:36     ` Jamie Lokier

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=20040310203857.GA7341@mail.shareable.org \
    --to=jamie@shareable.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.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