Data Link Control: B. R. Chandavarkar CSE Dept., NITK Surathkal
Data Link Control: B. R. Chandavarkar CSE Dept., NITK Surathkal
Data Link Control: B. R. Chandavarkar CSE Dept., NITK Surathkal
B. R. Chandavarkar
CSE Dept., NITK
Surathkal
• The two main functions of the data link layer are data link
control and media access control.
• The first, data link control, deals with the design and
procedures for communication between two adjacent nodes:
node-to-node communication.
• Data link control functions include framing, flow and error
control, and software implemented protocols that provide
smooth and reliable transmission of frames between nodes.
• To implement data link control, we need protocols.
• Each protocol is a set of rules that need to be implemented in
software and run by the two nodes involved in data exchange
at the data link layer.
• We discuss five protocols: two for noiseless (ideal) channels
and three for noisy (real) channels.
Framing
• The data link layer, on the other hand, needs to pack bits
into frames, so that each frame is distinguishable from
another.
• Framing in the data link layer separates a message from one
source to a destination, or from other messages to other
destinations, by adding a sender address and a destination
address.
• The destination address defines where the packet is to go;
the sender address helps the recipient acknowledge the
receipt.
• Although the whole message could be packed in one frame,
that is not normally done. One reason is that a frame can be
very large, making flow and error control very inefficient.
When a message is carried in one very large frame, even a
single-bit error would require the retransmission of the
whole message. When a message is divided into smaller
frames, a single-bit error affects only that small frame.
• Frames can be of fixed or variable size.
• In fixed-size framing, there is no need for defining the
boundaries of the frames; the size itself can be used as a
delimiter.
• An example of this type of framing is the ATM
(Asynchronous Transfer Mode) wide-area network, which
uses frames of fixed size called cells.
• In variable-size framing, we need a way to define the end of
the frame and the beginning of the next.
• Historically, two approaches were used for this purpose: a
character-oriented approach and a bit-oriented approach.
Character-Oriented Protocols
• In a character-oriented protocol, data to be carried are 8-bit
characters from a coding system such as ASCII.
• The header, which normally carries the source and
destination addresses and other control information, and the
trailer, which carries error detection or error correction
redundant bits, are also multiples of 8 bits.
• To separate one frame from the next, an 8-bit (1-byte) flag is
added at the beginning and the end of a frame.
• The flag, composed of protocol-dependent special characters,
signals the start or end of a frame.
• Character-oriented framing was popular when only text was
exchanged by the data link layers.
• The flag could be selected to be any character not used for text
communication.
• Now, however, we send other types of information such as graphs,
audio, and video. Any pattern used for the flag could also be part
of the information.
• If this happens, the receiver, when it encounters this pattern in
the middle of the data, thinks it has reached the end of the frame.
• To fix this problem, a byte-stuffing strategy was added to
character-oriented framing.
• In byte stuffing (or character stuffing), a special byte is added to
the data section of the frame when there is a character with the
same pattern as the flag.
• The data section is stuffed with an extra byte. This byte is usually
called the escape character (ESC), which has a predefined bit
pattern.
• Whenever the receiver encounters the ESC character, it removes
it from the data section and treats the next character as data, not
a delimiting flag.
Bit-Oriented Protocols
• In a bit-oriented protocol, the data section of a frame is a
sequence of bits to be interpreted by the upper layer as text,
graphic, audio, video, and so on.
• However, in addition to headers (and possible trailers), we
still need a delimiter to separate one frame from the other.
• Most protocols use a special 8-bit pattern flag 01111110 as
the delimiter to define the beginning and the end of the
frame.
• That is, if the flag pattern appears in the data, we need to
somehow inform the receiver that this is not the end of the
frame.
• We do this by stuffing 1 single bit (instead of 1 byte) to
prevent the pattern from looking like a flag. The strategy is
called bit stuffing.
• In bit stuffing, if a 0 and five consecutive 1 bits are
encountered, an extra 0 is added. This extra stuffed bit is
eventually removed from the data by the receiver.
• Note that the extra bit is added after one 0 followed by five
1s regardless of the value of the next bit.
• This guarantees that the flag field sequence does not
inadvertently appear in the frame.
Flow and Error Control
• The most important responsibilities of the data link layer
are flow control and error control. Collectively, these
functions are known as data link control.
Flow Control
• Flow control coordinates the amount of data that can be sent
before receiving an acknowledgment and is one of the most
important duties of the data link layer.
• In most protocols, flow control is a set of procedures that
tells the sender how much data it can transmit before it
must wait for an acknowledgment from the receiver.
• The flow of data must not be allowed to overwhelm the
receiver.
• Any receiving device has a limited speed at which it can
process incoming data and a limited amount of memory in
which to store incoming data.
• Error control in the data link layer is often implemented
simply: Any time an error is detected in an exchange,
specified frames are retransmitted. This process is called
automatic repeat request (ARQ).
Simplest Protocol
Stop-and-Wait Protocol
Stop-and-Wait ARQ Protocol
• Assume that, in a Stop-and-Wait ARQ system, the
bandwidth of the line is 1 Mbps, and 1 bit takes 20 ms to
make a round trip. What is the bandwidth-delay product? If
the system data frames are 1000 bits in length, what is the
utilization percentage of the link?
• The bandwidth-delay product is 20,000 bits during the time
it takes for the data to go from the sender to the receiver and
then back again. However, the system sends only 1000 bits.
We can say that the link utilization is only 1000/20,000, or 5
percent. For this reason, for a link with a high bandwidth or
long delay, the use of Stop-and-Wait ARQ wastes the
capacity of the link.
Sliding Window on Sender