ptg10805159
560 Interprocess Communication Chapter 15
Since these forms of IPC don’t use file descriptors, we can’t use the multiplexed I/O
functions (selectandpoll)with them. This makes it harder to use morethan one of
these IPC structures at a time or to use any of these IPC structures with file or device
I/O. For example, we can’t have a server wait for a message to be placed on one of two
message queues without some form of busy–wait loop.
An overview of a transaction processing system built using System V IPC is given
in Andrade, Carges, and Kovach[ 1989 ].They claim that the namespace used by
System V IPC (the identifiers) is an advantage, not a problem as we said earlier,because
using identifiers allows a process to send a message to a message queue with a single
function call (msgsnd), whereas other forms of IPC normally requireanopen,write,
andclose.This argument is false. Clients still have to obtain the identifier for the
server ’s queue somehow, to avoid using a key and callingmsgget.The identifier
assigned to a particular queue depends on how many other message queues exist when
the queue is created and how many times the table in the kernel assigned to the new
queue has been used since the kernel was bootstrapped. This is a dynamic value that
can’t be guessed or stored in a header.As we mentioned in Section 15.6.1, minimally a
server has to write the assigned queue identifier to a file for its clients to read.
Other advantages listed by these authors for message queues arethat they’re
reliable, flow controlled, and recordoriented, and that they can be processed in other
than first-in, first-out order.Figure15.25 compares some of the features of these various
forms of IPC.
Message types
IPC type Connectionless? Reliable? Flow control? Records? or priorities?
message queues no yes yes yes yes
STREAMS no yes yes yes yes
UNIX domain stream socket no yes yes no no
UNIX domain datagram socket yes yes no yes no
FIFOs (non-STREAMS) no yes yes no no
Figure 15.25 Comparison of features of various forms of IPC
(Wedescribe stream and datagram sockets in Chapter 16. We describe UNIX domain
sockets in Section 17.2.) By ‘‘connectionless,’’ we mean the ability to send a message
without having to call some form of an open function first. As described previously,we
don’t consider message queues connectionless, since some technique is required to
obtain the identifier for a queue. Since all these forms of IPC arerestricted to a single
host, all arereliable. When the messages aresent across a network, the possibility of
messages being lost becomes a concern.‘‘Flow control’’means that the sender is put to
sleep if there is a shortage of system resources (buffers) or if the receiver can’t accept
any moremessages. When the flow control condition subsides (i.e., when thereisroom
in the queue), the sender should automatically be awakened.
One featurethat we don’t show in Figure15.25 is whether the IPC facility can
automatically create a unique connection to a server for each client. We’ll see in
Chapter 17 that UNIX stream sockets provide this capability.The next three sections
describe each of the three forms of XSI IPC in detail.