Introduction to Interprocess Communication (IPC)
In software systems it is often the case that different processes need to communicate with one another in order to cooperate on some task. This is known as Interprocess Communication (IPC), and over the years many different mechanisms have been employed in order to perform IPC.Android provides its own mechanisms for IPC, but it should be noted here that the name IPC is a bit of a misnomer on Android, as the Android IPC mechanisms are designed to operate at the level of components rather than processes. In other words a component in one app may use IPC to communicate with a component in another app, or with another component in the same app. Thus IPC in Android is a bit more general than the name would imply.
Asynchronous and Synchronous IPCIn general IPC can take one of two forms:
- Asynchronous: with asynchronous IPC the sender does not wait for the receiver to receive the message. The send function or method returns immediately, and then sometime later the receiver receives the message. If the message requires a response from the receiver, then the message may supply details of how the receiver can send a reply to the sender.
- Synchronous: with synchronous IPC the send and receive are synchronised, and often from the receiver’s perspective it appears like a normal method or function call, with any response from the receiver passed to the sender as the return value from the send function or method. With synchronous IPC, if the receiver is slow responding to the message the sender will block until the receiver responds. This is often undesirable in user interface components.
Note for Nerds: as Android under the hood runs on Linux, the traditional Linux mechanisms for IPC like network sockets and shared files are available, but their use for app development is discouraged.
Secure Android App Development
Our purpose is to transform access to education.
We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.
We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.