Exercise 4 -- Reliable Message Delivery
Due: Thursday, Dec. 3, 1998
  1. The sequence numbers included in messages and acknowledgements on a data network must be stored in some fixed number of bits. As a result, the sequence numbers must behave like the numbers used to decide who gets served next at some bakeries and at the Stop and Shop Deli section. Basically, there must be some largest sequence number. After than number is used, the sequences must start off again with the smallest value. At Stop and Shop, the largest number is 99. Just as 99 is the largest number that can be written in two decimal digits, the largest sequence number used by a network protocol will usually be the largest number expressible in binary using the number of bits allocated.

    If they had only used one decimal digit at Stop and Shop, things might occasionally get confused. If more than ten customers were waiting at once, the "Now Serving" sign might announce a number held by more than one customer. Similar problems could occur in a network. Such problems can be avoided, however, by programming the computers in the network to refrain from sending too many messages at the same time if doing otherwise would cause confusion.

    To investigate the impact of these considerations, I'd like you to imagine a network protocol that uses as few binary digits for sequence numbers as possible (namely, 1 bit). In such a protocol, the only sequence numbers available would be 0 and 1. The first packet sent would be numbered 0, the second would be 1, the third would be 0, the fourth would be 1 and so on.

    Hopefully, it is obvious that in such a protocol it would not be safe to send more than two packets before receiving any acknowledgements. If it isn't obvious, the diagrams below are intended to illustrate one reason this would not be safe.

    In both diagrams, machine A sends three packets to machine B. Three distinct fill patterns are used to indicate the distinct packets. Because only two distinct sequence numbers are available, however, the first and third packets are both numbered "0".

    The diagram at the left is drawn to suggest that the first two packets are lost in transit and only the third packet is delivered and acknowledged. The diagram on the right shows a situation where the first packet is delivered, but its acknowledgment is slow in arriving. When A receives the acknowledgment indicating packet 0 has been received, there is no way it can distinguish the situation on the left from that on the right. As a result, it can not be certain whether the first or third packet sent is actually being acknowledged.

    In fact, it is not safe for A to send even the second packet before it has received an acknowledgment for the first packet. For this (long winded) problem, all I want you to do is draw diagrams similar to those shown above illustrating why it is not safe to send a second packet before the first has been acknowledged and briefly explain your diagram

If you have questions, you are encouraged to ask them through the discussion area for this homework assignment