Answers

advertisement
Chapter 9 Interprocess Communication
By Sape J. Mullender
Prepared by Natalia Khuri and Seetharam Samptur
Homework Questions and Answers
Q1.Easy: Give an example of communication where error correcting code works better
than error detection and an example, where neither error detection nor error correction is
needed.
A1.Easy: Error correcting code works better in the case of communication between
a space shuttle and its land control station. Due to long distance, the error rates are
high and so is the end-to-end latency. Data retransmission can be avoided by
including error-correcting codes.
In interactive continuous media application, the maximum acceptable endto-end latency is in the order of tens of milliseconds. Data retransmission is ruled
out, as late data is useless in audio/video applications. Since, human eye and ear
have a “built-in” error correction mechanism small gaps in data stream would not
be noticeable thus eliminating the need for error correcting codes.
Q2.Easy: At-least-once protocols deliver messages exactly once in the absence of failure
and may deliver messages more than once when failures occur. Such protocols work
when requests are idempotent; that is, when carrying the request more than once has the
same effect as carrying them out several times. Consider four possible file operations
listed below. Determine which operations are idempotent and which are not.
 Reading a file
 Writing to a file
 Creating a file
 Deleting a file
A2.Easy: Reading and writing a data block once has the same effect as reading and
writing it multiple times. Creating or deleting files are also idempotent, the result of
the operation is the same even though the first time the operation will succeed and
all subsequent tries will fail.
Q3.Easy: Certain transport protocols operate in the context of a session in order to
maintain protocol state and to guarantee at-most-once message delivery. Sessions must
have unique names, so that messages sent in one session are not received in another.
Propose a session name generation protocol for creating unique and crush-resistant
session names.
A3.Easy: A good way to choose session identifiers is to use timestamps as part of the
identifier. Most modern processors have a battery-operated clock whose value
survives crushes. Even, if such clock is missing, they can ask a network time service
for the time when they come up.
Q4.Easy: In RPCs, a program running on a machine of one endianness may have to deal
with structured data exported from a machine of a different endianness. Write a simple
‘C’ code snippet to determine a system’s endianness.
A4.Easy:
union u {
short s;
char c[sizeof(short)];
};
void sys_endianness()
{
union u u1;
u1.s = 0x0123;
if ( u1.c[0] == 0x23 )
printf("little-endian\n");
else
printf("big-endian\n");
}
int main(int argc, char *argv)
{
sys_endianness();
}
Q5.Difficult: Why is the process of multiplexing and demultiplexing data stream deemed
important in network communications? How does ATM make this process efficient
compared to Ethernet or other packet switched networks?
A.5.Difficult: There could be multiple applications communicating from a host and
hence large amount of data will be transmitted and received simultaneously.
Additionally, each application uses a separate network connection or virtual circuits
for communicating with a remote server. Hence sending and receiving data involves
lot of internal transfers or copies between the different protocol layers thus
increasing end-to-end latency.
In ATM, each cell size is fixed at 53 bytes, of which the header is of 5 bytes
and the rest user payload. The inclusion of the VCI in the header and due to the
small cell size, the ATM switches and edge nodes can parse the information quickly.
Also, since the VCI is associated with the application that initiated the connection,
the ATM interface card can DMA the payload into the receiving process’ memory
thus avoiding data copy.
In an Ethernet or token ring network, the MAC level packet headers do not
contain any information to demultiplex the received information. Also, the packet
size if around 1500 bytes when compared to the smaller 53-byte cell in an ATM
network making it harder to parse in a short time.
Q6.Difficult: Remember that passing functions as arguments is normally implemented by
passing a pointer to a function. In an RPC interface, function passing is almost
impossible. Describe the circumstances, where passing a function as an argument might
work in the RPC.
A6.Difficult: Passing of the function as an argument might work in RPC if we have
homogenous hardware, position-independent code, and no dependencies on global
variables.
Q7.Challenging: In RPC, client/server binding specifies how the relationship between a
remote procedure and the calling program will be established. A binding is formed when
two applications have made a logical connection and are prepared to exchange commands
and data. Define persistent and non-persistent biding and give examples of when it is
advantageous to use each one.
A7.Challenging: With persistent binding, a connection is set up for a remote
procedure call and sustained after the call returns. The connection is then used for
future RPCs. Non-persistent binding means that a logical connection is established
between the two processes at the time of the remote procedure call and that as soon
as the values are returned, the connection is dismantled. When the remote
procedure is called infrequently, it makes sense to use non-persistent binding to save
resourced needed to maintain the state information on both ends of the
communication channel. If the application makes many repeated calls to remote
procedures, persistent binding will save the overhead of establishing connection
each time.
Q8.Challenging: Certain transport layer protocols are based on packet blast protocol.
The idea is that some fixed number of packets is transmitted – a packet blast is sent and
acknowledged as one unit. This is an inefficient method for large packet transfers as the
entire blast has to be retransmitted in the case of a single packet failure. Suggest an
alternative connection-oriented protocol suitable for large packet transfers. Also, suggest
enhancements, if any, to the protocol when used in full duplex communication.
A8.Challenging: In a connection oriented protocol, in most cases, the packets are
guaranteed to be delivered in order at the receiver. For large packet transfers, a
sliding window protocol is ideal as the sender does not have to retransmit all the
packets in case of a dropped packet.
The basic idea of sliding window protocol is that both the sender and receiver keep a
“window” of acknowledgements sent and received. The sender keeps track of
expected acknowledgement while the receiver keeps track of the next expected
frame. The receiver sends an acknowledgement indicating the last received frame
and the next expected frame. On receiving the acknowledgement, the sender
advances the window and transmits the next set of packets.
When used in full duplex communication, the receiver restrains itself from sending
an acknowledgement immediately. The acknowledgement can be attached to the
header of the next outgoing frame. This eliminates the need to transmit control
frames whose sole purpose is to acknowledge the receipt of frames. This technique
of sending acknowledgement along with the data frame is called piggybacking.
Download