Question

I don't know alot about inter process communication but I want to make a simulation of the bully algorithm using inter process communication and after searching i found that there are mechanisms to use IPC

Clipboard COM Data Copy DDE File Mapping Mailslots Pipes RPC Windows Sockets

I don't know which mechanism is the best for this case !

I will tell you my thoughts but it may be wrong :)

I exclude these :

File Mapping is for file sharing (which is far from our example) COM : used for compound documents (which we don't want) DDE : because it is usually initiated by user command and not efficient as newer technologies File Mapping : because there is no way to guarantee that a datagram has been received. ClipBoard : because is almost always used for a one-time response to a user command, such as choosing the Paste command from a menu.

so the remaining mechanisms are :

Data Copy

Pipes

RPC

WindowsSockets

so which is the best mechanism to use at these cases

1) if the communication is on the same computer 2) among different computers

Was it helpful?

Solution

If the requirement of running the processes in (a) same machine, as well as (b) different machine is important, then I would choose TCP/IP Internet sockets (AF_INET). It works in both situations and complexity is completely hidden from the application.

(Note that, if performance is the dominating metric, then I would choose differently for case #a.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top