Datalink Layer
Datalink Layer
Lecture 2
Datalink layer
Learning Outcomes
Understanding of:
Data Communication components and char-
acteristics
Data Link Layer
The Data-Link layer contains two sublayers that are described in the IEEE-802 LAN
standards:
Data-link control (DLC) deals with procedures for communication between two
adjacent nodes—node-to-node communication—no matter whether the link is
dedicated or broadcast
– Framing
– flow control
– error control
Framing
The data link layer packs 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 des-
tination by adding a sender address and a destination address.
Frame Size
Frame Size
Variable-size framing
In variable-size framing, we need a way to define the end of one frame and the
beginning of the next. Historically, two approaches have been used for this purpose:
• character-oriented approach
• bit-oriented approach.
Character-Oriented Framing
Character-Oriented Framing
In character-oriented (or byte-oriented) framing, 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 redundant bits, are also multi-
ples 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
Byte-stuffing
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) and 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 as a
delimiting flag.
Character-Oriented Framing
in bit-oriented framing, 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 end of the frame, as shown in Figure
Bit Stuffing
This flag can create the same type of problem we saw in the character-oriented protocols. 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 one single bit (instead of one byte) to prevent the pattern from
looking like a flag. The strategy is called bit stuffing.
Flow control refers to a set of procedures used to restrict the amount of data that
the sender can send before waiting for acknowledgment
Ensuring the sending entity does not overwhelm the receiving entity
Preventing buffer overflow (giving ample time to the processor to process)
Error Control
Error control in the data link layer is based on automatic repeat request, which is
the retransmission of data.
Automatic repeat request (ARQ)
– Error detection (Damaged Frames, Lost Frames)
– Positive acknowledgment
– Negative acknowledgement and retransmission
– Retransmission after timeout
Dr. Manzoor 17
Model of Frame Transmission
Data Link Control
Dr. Manzoor 19
Noiseless Channel
Let us assume we have an ideal channel in which no frames are lost, duplicated, or
corrupted
None of the above have error control as they are for noiseless (ideal) channel
Dr. Manzoor 20
Simplest Method
Dr. Manzoor 21
Stop-And-Wait
Dr. Manzoor 23
Automatic Repeat Request (ARQ)
Go back N
Selective repeat
Stop and Wait ARQ
Dr. Manzoor 25
Stop and Wait ARQ
Dr. Manzoor 30
4. Delayed ACK
Dr. Manzoor 31
Go-back-N ARQ
To improve efficiency multiple frames should be in transition while waiting for ACK
In sliding window method, multiple frames are sent by sender at a time before need-
ing an acknowledgment
Sliding window refers to an imaginary boxes that hold the frames on both sender and
receiver side.
Sender sliding window
i.e. Go-Back-N
Operation of Go-back-N
Dr. Manzoor 37
1. Normal Operation
2. Lost or damaged frame
3 & 4. Lost or delayed ACK
Dr. Manzoor 40
Selective Repeat ARQ
Go-back-N ARQ
– simplifies the process at receiver site
– very inefficient for a noisy channel (resending many frames when
only one was damaged)
Solution: Selective Repeat ARQ
– Processing at receiver is complex
– More efficient for noisy links (resends damaged frames only)
Dr. Manzoor 41
Lost frame
Bandwidth-Delay Product
Solution
The bandwidth-delay product is
The system can send 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%. For this reason, for a link with high bandwidth or long delay, use of Stop-and-Wait
ARQ wastes the capacity of the link.
Example
What is the utilization percentage of the link in the previous example if the link
uses Go-Back-N ARQ with a 15-frame sequence?
Solution
The bandwidth-delay product is still 20,000. However , now the system can
send up to 15 frames or 15,000 bits during a round trip. This means the
utilization is 15,000/20,000, or 75 percent. Of course, if there are damaged
frames, the utilization percentage is much less because (some) frames have to
be resent.
Dr. Manzoor 45
THANK YOU