public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Paul de Vrieze <pauldv@gentoo.org>
To: gentoo-dev@gentoo.org
Subject: Re: [gentoo-dev] What is the fastest mechanism for ipc communication under the gentoo-sources kernel
Date: Tue, 22 Jul 2003 20:30:57 +0200	[thread overview]
Message-ID: <200307222031.01286.pauldv@gentoo.org> (raw)
In-Reply-To: <FHEELGILKDENPLDMDNMJGEFODJAA.jbadams@intensifi.com>

[-- Attachment #1: signed data --]
[-- Type: text/plain, Size: 1533 bytes --]

On Tuesday 22 July 2003 19:07, Jeff Adams wrote:
> Hello,
>
> I have a producer process that makes updates to shared memory.  I need to
> notify consumer processes (potentially multiple) as quickly as possible.
>
> What I am looking for is a fast "wake-up" mechanism and a synchronization
> mechanism so that events are not lost.
>
> I'm currently using semaphores as the wake up mechanism.  Question is this
> the fastest way to do this without going into a tight loop (waste of
> processor cycles)?
>
> I'd also have the issue of clients showing up asynchronously.  If I just
> use semaphores counts based on the number of clients I run the risk of
> missing a client.  Also if the clients process events too slowly then the
> producer will keep incrementing the semaphore beyond the client count. 
> Then if one client is faster than the others it may get awakened multiple
> times for the same event.
>
> Any suggestions?
>

You could use pipes as IPC. In that case you push a byte in the pipe at the 
moment you want the clients to wake up. This should make them me scheduled as 
soon as possible (in case they are locked waiting for the pipe). Another way 
could be to use signals. But if you give each process a semaphore that should 
also work. The only question is whether it is a problem if one process has a 
slightly higher chance to be first than the other processes. Normally it 
isn't.

Paul

-- 
Paul de Vrieze
Researcher
Mail: pauldv@cs.kun.nl
Homepage: http://www.devrieze.net

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2003-07-22 18:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-22 17:07 [gentoo-dev] What is the fastest mechanism for ipc communication under the gentoo-sources kernel Jeff Adams
2003-07-22 18:30 ` Paul de Vrieze [this message]
2003-07-23  3:43   ` Dave Nellans
2003-07-23 14:13     ` wes chow

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=200307222031.01286.pauldv@gentoo.org \
    --to=pauldv@gentoo.org \
    --cc=gentoo-dev@gentoo.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