public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Mai Daftedar <mai.daftedar@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Inter Thread Coomunication
Date: Wed, 02 Dec 2009 13:36:56 +0100	[thread overview]
Message-ID: <4B165F68.70605@ladisch.de> (raw)
In-Reply-To: <2cd4ff050912020417r27b52a89v4e676c7d4ab74ad4@mail.gmail.com>

Mai Daftedar wrote:
>    I have a question to ask I have two threads that have
> messages(Structure with data) that should be passed between them.
> After some googling I learnt that using queues and pipes are expensive
> (effieciency wise) and that I should just pass in the parameters and
> use mutex to protect shared data...

What is expensive is not necessarily the copying of the data into and
out of the pipe (this depends on the amount of data), but the system
calls necessary for this.  If your threads use mutexes to wait for the
data, you have system calls anyway (actually going to sleep and waking
up cannot be handled in userspace), so there might not be any difference
one way or the other.  The only way to find out is to test both
mechanisms.


HTH
Clemens

  reply	other threads:[~2009-12-02 12:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02 12:17 Inter Thread Coomunication Mai Daftedar
2009-12-02 12:36 ` Clemens Ladisch [this message]
2009-12-02 17:19 ` Stefan Richter

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=4B165F68.70605@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mai.daftedar@gmail.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