With synchronization, communication is possible. Communication is a
big, big issue in computer science. Over the past decade or so, with
the growth of operating system technology, the focus has been on
communications within the computer. Now, with great interest in
network technology, that interest has broadened to communication
between computers. To introduce the subject, I will focus on the
communication types within a computer. To communicate, it is critical to agree on a
protocol. Here are several to choose:
- Shared Memory
- is the most general form of interprocess
communication. Two processes share an address space, a common
``blackboard'' to communicate. There is ``in-transit'' state for
information and communication is simple and instantaneous. However
this flexibility is shared memory's pitfall. With so few constraints
on the shared access to data, it is easy to err and corrupt it. What's more,
information may flow anywhere and protection is difficult to
enforce. Finally, it is not easy to extend the shared memory
abstraction to situations where the information communicated is
larger than memory, or, worse, between machines.
- Message Passing
- provides a little more control. Processes
communicate by passing messages to one another. The messages are
just records of bytes, and within a single machine, communication can
can be nearly as fast as shared memory because the message data need
not be copied. But, because communication is divided into logical
units, the message passing abstraction can extend to communication
between machines with no modification to its interface. Several
flavors of message passing are available. In the most general form,
messages can be sent and received from any number of independent
mailboxes, separate from the processes. In distributed systems, due
to communication costs, ports are often implemented instead.
Unlike a mailbox, a port is associated with a specific process. Any
process can send messages to a process' ports, but only that process
can receive from it.
- Remote Procedure Calls
- are a form of message passing
particularly suited for distributed systems. A seemingly normal
procedure call is actually invoked on another machine. RPC's are a
form of synchronous message passing, as the caller is suspended
while his function evaluates. Nevertheless, because of the familiar
``procedure'' packaging, RPC's are becoming increasingly popular and
allow distributed programs to be quickly built.
- Pipes
- provide a still more restrictive interface.
Popularized by the UNIX operating system, pipes provide a one- or
two-way byte stream between two processes. Unlike message
systems, pipes are point-to-point established connections. Connection
setup and the copying of data through the pipe add to the pipe
protocol's cost. What's more, data must be formatted into a stream of
bytes on the transmitting end, and then reformatted into usable data
on the receiving end. Yet these very restrictions have encouraged a
uniform interchangeable interface for programs, a prized aspect of the
UNIX operating system.