Inter process and inter computer communication
This is a question about concepts rather that detail. I come from a background of using QNX4, which is a micro kernel real time os.
What methods exist for communicating between processes? Signals I understand, but these are a bit limiting. I've seen people use tcp/ip sockets, but this seems less than ideal, especially when all the processes are on one machine. To extend this a little further, say I have a bunch of computers on an Ethernet network, what methods exist to communicate between processes on different machines? |
Quote:
I believe OpenMPI (an MPI implementation) uses shared memory locally, making it surprisingly efficient even locally. (While you can do better by using shared memory explicitly, you need to be aware of cache effects and especially cacheline ping-pong; most programmers don't care, and OpenMPI ends up being faster/better..) Quote:
Again, the lists above are not exhaustive. They are only the ones I've seen used well, and would consider for myself. My own background is in Physics (Computational Materials Physics, to be precise), and I work with high-performance computing. In my case, Linux clusters running distributed physics and/or chemistry simulations. In this arena, MPI seems to be the best choice for interprocess communication. (Funnily enough, because of algorithmic choices and unawareness of cache-related effects, for most programmers MPI yields a faster parallel simulator than when using threads/shared memory, when running on one computer. This means the overheads in MPI implementations, OpenMPI for example, are very low. Certainly, if you want the same program to be distributable locally (multiple processes on the same machine), and over the network, MPI is the best choice I know of.) If you are using Linux, I would suggest looking first at MPI for parallel and distributed processing. If you work with e.g. IP-connected microcontrollers, then you might consider using UDP sockets instead. There are some TCP stacks too for microcontrollers, but unless you intend to use a protocol that is implemented on top of TCP, I'd go for UDP instead, and design the communications so that missing packets will be detected and retransmitted if/when necessary. For example, a sensor package transmitting its status every couple of seconds probably should not bother retransmitting its old status. If you are working on a multiplatform client-server application, RPC (or similar, perhaps libevent or SOAP) might suit best. Hope this helps, |
All times are GMT -5. The time now is 11:28 PM. |