Message Passing vs. Remote Procedure Call
This article focusses on how and when Message Passing better than Remote Procedure Call and vice-versa
Message Passing and RPC are two major used methods of computer communication. RPC is built on top of MP.
MP, on one hand, provides a non-reliable, asynchronous method of communication, RPC, on the other hand, provides reliable and synchronous communication.
The arguments between MP and RPC are going to be very similar to the arguments between UDP and TCP. Since, RPC is a layer on top of MP; End-to-End argument applies here.
RPC fits better in a client server model while MP fits better in a peer-to-peer/Ad-hoc model of communication.
- More complication at the programmer.s end but OS is simple
- Programmer needs to do explicit marshalling/de-marshalling of the data being sent across
- with MP we can achieve good concurrency
- less synchronous, hence ideal for application where synchrony is not a required feature
- multicast is possible
- No dynamic resource discovery (early binding), (though a service like DNS can be used)
- More complication at the OS level and programmer.s life is easier
- For programmer, it is almost like a local call.
- Very less concurrency (threading required to achieve the concurrency, if needed)
- Totally synchronous
- Multicast will be tedious to achieve. (again looping or threading would be required to achieve the multicast, if needed)
- Resource discovery mechanisms are provided (late binding)
Alternative steps a programmer needs to take while using MP:
- Since reliability is not provided by default in MP, we can use reliable send (a send which will not return unless the message has been delivered to the other end) can be used.
- Similarly, a reliable send would also provide us with synchronous behavior.
- Programmer can write his own marshalling and de-marshalling algorithms.
- Programmer can develop his own resource discovery mechanisms.
How does RPC provides these things:
- RPC does provide reliability
- RPC calls are synchronous by nature/implementation
- RPC abstracts away the marshalling/de-marshalling details from the programmer. Hence programmer doesn.t have to worry about the same
- RPC provides central resource manager
To sum it up, RPC does provide extra functionalities but if they are not required in a certain scenario, these extra functionalities would end up creating lot delays and performance overheads, and hence MP would be a better option. But if you need to pass around complicated data structures and the scenario requires lot of synchronous communications among servers, then RPC would be a preferred choice.
- All the reading materials.
- Shreyas, Yuki and myself met for a discussion.
- Hashem and I met for a separate round of discussion.
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees