Message Passing Techniques

  • Thread starter Thread starter Curious
  • Start date Start date
C

Curious

Hi,

I need some technique to communicate by passing messages with different
threads. For my problem shared memory is not applicable.

Can someone give me some help of what there is available in the .net.

Thanks in Advance
 
Curious,

What kind of messages do you need to pass between threads? It might be
possible to replace the logic you are trying to implement (from what it
seems like a legacy system where you didn't have a thread pool) with
something else.

For what reason are you trying to pass messages between threads? Are
you managing these threads yourself, and if so, why arent you using the
thread pool?
 
Basically I will be passing numbers and strings.

I need to pass data between different threads, since the main objective
is to make the program run in a distributed way, where each thread will
be representing a different host connection in the distributed
approach.

I require something that controls the messages it receives and it sends
from all other threads. This will be implemented as a library which
will then be converted to another library implementing the distributed
approach.

Controller ----> Sends and Receives messages send by Thread A, Thread
B, Thread C, etc......

Controller ----> Sends and Receives messages send by Host A, Host B,
Host C, etc.... in the distributed approach.

Now to solve the problem, I was thinking of using MessageQueue. Is
there something else, or can some more information regarding
MessageQueues be given.

Thanks in Advance
 
Curious said:
Basically I will be passing numbers and strings.

I need to pass data between different threads, since the main objective
is to make the program run in a distributed way, where each thread will
be representing a different host connection in the distributed
approach.

I require something that controls the messages it receives and it sends
from all other threads. This will be implemented as a library which
will then be converted to another library implementing the distributed
approach.

Controller ----> Sends and Receives messages send by Thread A, Thread
B, Thread C, etc......

Controller ----> Sends and Receives messages send by Host A, Host B,
Host C, etc.... in the distributed approach.

Now to solve the problem, I was thinking of using MessageQueue. Is
there something else, or can some more information regarding
MessageQueues be given.

Do you need persistence of the messages? If not, the simplest thing
would be to use a producer/consumer queue. See

http://www.pobox.com/~skeet/csharp/threads/deadlocks.shtml

(about half way down).
 
Back
Top