Retransmission

Data link layer's approach to dealing with corrupted or lost frames is to retransmit
them. Two different methods exist for this purpose. In the first method, called
Selective Reject, upon encountering a faulty frame, the receiver requests the
retransmission of that specific frame. Since additional frames may have followed the
faulty frame, the receiver needs to be able to temporarily store these frames until it
has received a corrected version of the faulty frame, so that frame order is
maintained.

A simpler method, Go-Back-N, involves the transmitter requesting the
retransmission of the faulty frame as well as all succeeding frames (i.e., all frames
transmitted after the faulty frame). In other words, the receiver will not accept frames
out of order and hence requires no additional means of storing them.
The advantage of Selective Reject over Go-Back-N is that it leads to better
throughput, because only the erroneous frames are retransmitted. Go-Back-N,
however, has the advantage of being simpler to implement and requiring less
memory. To obtain the best of both worlds, sometimes a hybrid method is used. It
behaves the same as Selective Reject, unless two consecutive frames are in error, in
which case it behaves as in Go-Back-N.

Flow Control

The various stations in a network may operate at different speeds. One of the tasks
of the data link layer is to ensure that slow devices are not swamped with data from
fast devices. Flow control refers to the regulating of the rate of data flow from one
device to another so that the receiver has enough time to consume the data in its
receive buffer, before it overflows.

In character-oriented protocols, flow control is usually based on two control
characters: XON and XOFF. When the receiver senses that it can no longer accept
incoming data, it sends an XOFF character to the transmitter, which causes the latter
to stop transmitting. Once the receiver has consumed enough of the data in its
receive buffer so that it can receive more, it sends an XON character to the
transmitter, causing it to resume transmission.

In bit-oriented protocols, flow control is handled through the use of ACK
frames. Since the transmitter needs to keep a copy of its transmitted but yet
unacknowledged frames in a buffer (in case they are corrupted and need to be
retransmitted), the size of the buffer imposes an upper limit on the number of such
frames. When necessary, the receiver can use this fact to slow down the transmitter
by withholding ACK frames. The protocol described in the next section uses exactly
such a strategy.