* Inter Thread Coomunication
@ 2009-12-02 12:17 Mai Daftedar
2009-12-02 12:36 ` Clemens Ladisch
2009-12-02 17:19 ` Stefan Richter
0 siblings, 2 replies; 3+ messages in thread
From: Mai Daftedar @ 2009-12-02 12:17 UTC (permalink / raw)
To: linux-kernel
Hi all,
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...
Can anyone add on to this tradeoff information
Note: Can you CC me in the reply
Thanks
Best Regards
Mai
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Inter Thread Coomunication
2009-12-02 12:17 Inter Thread Coomunication Mai Daftedar
@ 2009-12-02 12:36 ` Clemens Ladisch
2009-12-02 17:19 ` Stefan Richter
1 sibling, 0 replies; 3+ messages in thread
From: Clemens Ladisch @ 2009-12-02 12:36 UTC (permalink / raw)
To: Mai Daftedar; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Inter Thread Coomunication
2009-12-02 12:17 Inter Thread Coomunication Mai Daftedar
2009-12-02 12:36 ` Clemens Ladisch
@ 2009-12-02 17:19 ` Stefan Richter
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Richter @ 2009-12-02 17:19 UTC (permalink / raw)
To: Mai Daftedar; +Cc: linux-kernel, clemens
Mai Daftedar wrote:
> 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...
> Can anyone add on to this tradeoff information
The entire point of threads (in contrast to processes) is to share an
address space for convenience or/and performance. If a shared address
space is not really required, separate processes could be used instead
with the huge advantage of memory protection.
--
Stefan Richter
-=====-==--= ==-- ---=-
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-12-02 17:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-02 12:17 Inter Thread Coomunication Mai Daftedar
2009-12-02 12:36 ` Clemens Ladisch
2009-12-02 17:19 ` Stefan Richter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox