public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Miell <nmiell@comcast.net>
To: Edgar Toernig <froese@gmx.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] /dev/itimer
Date: Fri, 28 Jul 2006 15:33:35 -0700	[thread overview]
Message-ID: <1154126015.2451.13.camel@entropy> (raw)
In-Reply-To: <20060728235951.7de534eb.froese@gmx.de>

On Fri, 2006-07-28 at 23:59 +0200, Edgar Toernig wrote:
> Hi,
> 
> this is a simple driver which provides interval timers via
> file descriptors.
> 
> Everytime I have to write code to do something at regular
> intervals I face the problem that the time routines on Unix 
> are pretty archaic.  Only a single process wide timer which
> notifies via signals.  The single timer asks for a dedicated
> roll-your-own timer infrastructur, usually implemented via
> a lot of gettimeofday calls and appropriate select timeouts.
> But even if the single timer is enough, the delivery via
> signals is error prone and breaks a lot of (i.e. library)
> code, especially when the timer rate is high.  One common
> work around is forking a separate task which gets the signals
> and a pipe to notify the main process which may select/poll
> the other and of the pipe.  But this is pretty heavy-weight
> and not easy to get right either.  Recently, people started
> to use the real time clock driver (/dev/rtc) to get an fd
> to sleep on.  But this is even worse as there's (usually)
> only a single one in the whole system and you have to decide
> whether i.e. mplayer, artsd, timidity, or vdr gets it.

Pretty much everything in this paragraph is wrong, except for the part
about the difficulty of making a single unified event loop and the
resulting pipe hack that everybody uses to get around that.

Solaris lets you specify SIGEV_PORT in your struct sigevent which then
queues timer completions (or anything else that takes a struct sigevent,
like POSIX AIO) to a port and then all types of queued events (including
fd polling and user generated events) can be waited on and fetched with
a single function call.

Something similar could probably worked up in Linux which queues timer
completions to an AIO context.

You might also want to look into the event channel / kevent discussion
that's currently in progress.

-- 
Nicholas Miell <nmiell@comcast.net>


  reply	other threads:[~2006-07-28 22:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-28 21:59 [RFC] /dev/itimer Edgar Toernig
2006-07-28 22:33 ` Nicholas Miell [this message]
2006-07-28 22:44   ` Edgar Toernig
2006-07-28 23:14     ` Nicholas Miell
2006-07-28 22:43 ` DervishD
2006-07-28 23:01   ` Edgar Toernig
2006-08-01 14:40 ` Clemens Ladisch
2006-08-01 15:32   ` Steven Rostedt

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=1154126015.2451.13.camel@entropy \
    --to=nmiell@comcast.net \
    --cc=froese@gmx.de \
    --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