threads and processes

Hi,

I encounter the problems in writing some codes about threads and processes.
I have three processes, Task A is to read the port repeatedly and when
the bit is changed, it sends message to Task B, which is a control task.
After Task B receive the messages, in terms of different received message
it send message to the Task C or Task D . Now when handling the
communications
of these tasks, if I choose the processes to solve this prolem, I can create
one
thread in each process with using MsgSend() and MsgReceive() to communicate.
However,
if I take these task as threads in a single process, does the communication
between
threads in a process use the message passing? Otherwise, what is the
communication way
between the threads in one process?

Could be connectAttach() and ChannelCreate() worked in the two threads of a
process? If
they do, how to set up the connection?


Thanks,

Belinda

Belinda <yye@is2.dal.ca> wrote:

Hi,

I encounter the problems in writing some codes about threads and processes.
I have three processes, Task A is to read the port repeatedly and when
the bit is changed, it sends message to Task B, which is a control task.
After Task B receive the messages, in terms of different received message
it send message to the Task C or Task D . Now when handling the
communications
of these tasks, if I choose the processes to solve this prolem, I can create
one
thread in each process with using MsgSend() and MsgReceive() to communicate.
However,
if I take these task as threads in a single process, does the communication
between
threads in a process use the message passing? Otherwise, what is the
communication way
between the threads in one process?

Could be connectAttach() and ChannelCreate() worked in the two threads of a
process? If
they do, how to set up the connection?

You can use interprocess communications (MsgSend/MsgReceive) between any
two threads anywhere in the QNX 6 world – thread-to-thread on the same
process, on the same machine, or in the same network.

That said, you don’t have to use it if you don’t want to. For maximum
portability of multithreaded apps, you’ll want to use the POSIX pthread_()
functions; for portability of multi process systems, you’ll want to use
POSIX message queues, signals (yuck) and so on. For maximum portability
in a networked environment, you’ll want to use TCP/IP and RPC.

But the nice thing is, you can use IPC “orthogonally” in QNX 6.

Cheers,
-RK


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Consulting and Training at www.parse.com
Email my initials at parse dot com.