The main task of the data link layer is to take a raw transmission facility and transform it into a line that appears free
of transmission errors in the network layer. It accomplishes this task by having the sender break the input data up into data
frames (typically a few hundred bytes), transmit the frames sequentially, and process the acknowledgment frames sent back
by the receiver. Since the physical layer merely accepts and transmits a stream of bits without any regard to meaning of structure,
it is up to the data link layer to create and recognize frame boundaries. This can be accomplished by attaching special bit
patterns to the beginning and end of the frame. If there is a chance that these bit patterns might occur in the data, special
care must be taken to avoid confusion.
The data link layer should provide error controllbetween adjacent nodes.
Another issue that arises in the data link layer (and most of the higher layers as well) is how to keep a fast transmitter
from drowning a slow receiver in data. Some traffic regulation mechanism must be employed in order to let the transmitter
know how much buffer space the receiver has at the moment. Frequently, flow regulation and error handling are integrated,
If the line can be used to transmit data in both directions, this introduces a new complication that the data link layer
software must deal with. The problem is that the acknowledgment frames for A to B traffic compete for the use of the line
with data frames for the B to A traffic. A clever solution "piggy backing" has been devised.