public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ulrich Drepper <drepper@redhat.com>
To: jim.houston@attbi.com
Cc: linux-kernel@vger.kernel.org, jim.houston@ccur.com
Subject: Re: signal queue resource - Posix timers
Date: Wed, 28 May 2003 15:01:17 -0700	[thread overview]
Message-ID: <3ED531AD.1020309@redhat.com> (raw)
In-Reply-To: <200305281856.h4SIuFZ02449@linux.local>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Posix timers are required to fail the
> timer_create with EAGAIN if "the system lacks sufficient signal queuing
> resources to honor the request."  The current Linux posix-timers 
> implementation doesn't do this.

That's not really how you can interpret this.  At the time timer_create
is it is not know when the timer expires and whether it's a repeating
timer.  Therefore it is not correct to assume that if timer_create
succeeds the resources to always deliver the signal are available.

The shall-error in the standard just covers the case if there is really
no way this can be made working.  For instance, some implementation
might allocate to each process using timer_create N signal slots.  The
whole system could have only N * M slots.

Because there is no fixed limit (or better said: no guaranteed minimal
number of signal slots) in Linux this error doesn't apply at all.


> I'm contemplating changes to kernel/signal.c to allow reserved or
> pre-allocated sigqueue structures to be used.  The idea is to do the
> allocation in the system call context so the failure can be returned to
> the application.

Allocate how and what for?

If you mean allocating signal slots for the process, this is wrong.  It
should never we the case that a process accumulates many outstanding
signals.  Every limit is reached at some point and then all further
signals are ignored.  This is problematic because there is no guarantee
whatsoever that all signals come from the same timer and therefore later
signals can be safely ignored (to some degree of safety).  You might
lose the one event a long-running timer generates.

Allocating signal slots to the timer object does make sense.  But the
number must be small.  This indeed makes the signal handling simpler and
more robust.  Especially wrt to the just mentioned example, a often
expiring timer won't flood the signal system so that the events of other
timers are lost.

What I don' understand is why you bring up this 2000 outstanding signal
issue.  It never makes sense to handle this, especially not when the
events come from one system.  If really a high number of signals is used
the system is specialized and it not a problem to require a kernel
recompilation with new limits.


In summary: I think allocate, say, 16 signal slots per timer is a good
idea.  It means all timers are treated fairly which is important.  But
it should never be a goal to optimize the system for hundreds or even
thousands of outstanding signals.

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+1TGt2ijCOnn/RHQRAiyVAJ0bOIVhou4LAw5WR3hDuc+o60uEbwCgr6V9
Nfo2tgcmiU6q8M9GGacqXvE=
=JTEF
-----END PGP SIGNATURE-----


  reply	other threads:[~2003-05-28 21:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-28 18:56 signal queue resource - Posix timers Jim Houston
2003-05-28 22:01 ` Ulrich Drepper [this message]
2003-05-28 23:14   ` Jim Houston
2003-05-29  2:16   ` William Lee Irwin III
2003-05-29  1:46 ` William Lee Irwin III
2003-05-29  5:26   ` Ed L Cashin
2003-05-29 16:07     ` Timothy Miller

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=3ED531AD.1020309@redhat.com \
    --to=drepper@redhat.com \
    --cc=jim.houston@attbi.com \
    --cc=jim.houston@ccur.com \
    --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