0% found this document useful (0 votes)
2 views

03-DataLink

The document discusses the Data Link Layer in data communication, focusing on data link control functions such as framing, flow control, and error control. It explains various protocols including Stop-and-Wait ARQ, Go-Back-N ARQ, and Selective Repeat ARQ, along with their mechanisms for handling frame transmission and error correction. Additionally, it covers HDLC as a bit-oriented protocol for communication and its frame structure, including different frame types and their purposes.

Uploaded by

naqeebzai52
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

03-DataLink

The document discusses the Data Link Layer in data communication, focusing on data link control functions such as framing, flow control, and error control. It explains various protocols including Stop-and-Wait ARQ, Go-Back-N ARQ, and Selective Repeat ARQ, along with their mechanisms for handling frame transmission and error correction. Additionally, it covers HDLC as a bit-oriented protocol for communication and its frame structure, including different frame types and their purposes.

Uploaded by

naqeebzai52
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Data Communication & Computer Networks

Data Link Layer

Data Link Control „ Responsible for node-


to-node (hop-to-hop)
communication.
„ The two main functions
of the data link layer are
{ Data link control
{ Media access control

Prof. Dr. Manzoor Hashmani


[email protected] MH 2

Data Link Control Framing

„ Deals with the design and procedures „ The data link layer packs bits into
for communication between two frames, so that each frame is
adjacent
j nodes ((node-to-node distinguishable
g from another.
communication) „ The data link layer adds a sender
„ Data link control functions include address and a destination address to
{ framing the frames.
{ flow control
{ error control
MH 3 MH 4

Framing Character-Oriented Protocols


„ Fixed-size framing
„ Data to be carried are 8-bit characters
{ no need for defining the boundaries of the
frames from a coding system such as ASCII
„ V i bl i fframing
Variable-size i „ Header and trailer are also multiples of
{ need a way to define the end of the frame
8 bits.
and the beginning of the next frame „ An 8-bit flag at the beginning and the
{ two approaches used for this purpose: end of a frame define frame boundaries
„ a character-oriented approach
„ a bit-oriented approach
MH 5 MH 6

1
Bit-Oriented Protocols Flow Control
„ The data section of a frame is a
sequence of bits to be interpreted by „ Flow control refers to a set of
the upper layer as text, image, audio, procedures used to restrict the amount
video etc.
video, etc of data that the sender can send before
waiting for acknowledgment
„ Most protocols use a special 8-bit
pattern flag 01111110 as the delimiter „ Ensuring the sending entity does not
to define the frame boundaries overwhelm the receiving entity
{ Preventing buffer overflow (giving ample time
to the processor to process)
MH 7 MH 8

Error Control Model of Frame Transmission


„ 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
MH 9 MH 10

Data Link Control Noiseless Channel

„ Let us assume we have an ideal


channel in which no frames are lost,
duplicated,
p , or corrupted.
p
„ For such a channel we have…
{ Simplest Method (no flow control)
{ Stop-and-Wait Method (with flow control)
„ None of the above have error control as
they are for noiseless (ideal) channel
MH 11 MH 12

2
Simplest Method Stop-and-Wait

„ The sender sends


one frame
„ Stops and Waits
until it receives
confirmation from
the receiver
„ Then sends the next
frame
„ Thus Flow Control
MH 13 MH 14

Stop-and-Wait Method Noisy Channel

„ In reality noiseless (error-free)


channels do not exist.
„ Therefore in noisy channel
Therefore, channel, we need
error control as well.
„ Error control in the data link layer is
based on Automatic Repeat Request
(ARQ).

MH 15 MH 16

Automatic Repeat Request


(ARQ) Stop and Wait ARQ
„ It is the simplest flow and error control
„ Stop and wait
mechanism
„ Source transmits frame & keeps a copyy
„ Go back N „ Destination receives frame and replies
with acknowledgement
„ Selective repeat „ Source waits for ACK before sending
next frame

MH 17 MH 18

3
Stop and Wait ARQ Operation of Stop and Wait

„ If received frame damaged, discard it „ We can have four different situations


{ Transmitter has timeout in the transmission of a frame:
{ If no ACK within timeout, retransmit 1. Normal operation
„ Numbering the frames prevents the 2. Loss of frame
retaining of duplicate frames 3. Loss of ACK
{ ACK number defines the number of next 4. Delay of ACK
expected frame
{ Use ACK0 and ACK1
MH 19 MH 20

1. Normal Operation 2. Lost or damaged frame


„ Lost or damaged
frames are
handled in the
same manner (No
ACK)

MH 21 MH 22

3. Lost or damaged ACK 4. Delayed ACK


„ If ACK damaged
transmitter will not
recognize it
{ Transmitter will
retransmit
{ Receive gets two
copies of frame
{ Use ACK0 and
ACK1

MH 23 MH 24

4
Piggybacking Go-back-N ARQ
„ In bidirectional transmission both parties keep record
of sent and expected frame numbers „ Stop-and-Wait ARQ is simple but inefficient
„ Piggybacking „ To improve efficiency multiple frames should
saves be in transition while waiting for ACK
bandwidth „ T
Transmitter
itt can send d W frames
f without
ith t ACK
(reduces „ A copy of each frame is kept until ACK arrives
overheads
like CRC,
„ Each frame is numbered
addresses, „ Sequence number bounded by size of field
etc.) { If frame header allows m bits for sequence
number, number range will be 0 to 2m - 1

MH 25 MH 26

Sender sliding window Receiver sliding window


„ Sender uses a window to hold frames until ACK „ The size of window at receiver is 1
„ Frames on left of window are acknowledged „ The receiver is always waiting for a specific
„ Frames on right can’t be sent until window frame to arrive in a specific order
slides over

MH 27 MH 28

Go-Back-N Control variables Go-Back-N Acknowledgment


Sender Variables
„ If no error, ACK as usual with next
„ S = recently sent frame „ Receiver has only 1
variable R that hold frame expected
„ SF=1st frame in window
the sequence no. of „ Receiver can send one cumulative
„ SL=last frame in window
p
the expected frame
W = Size of sliding window ACK ffor severall fframes
= SL – SF + 1
„ If error,
{ Discard that frame and all future frames
until error frame received correctly
{ Transmitter must go back and retransmit
that frame and all subsequent frames
MH 29 MH 30

5
Operation of Go-back-N 1. Normal Operation

„ We can have four different situations


in the transmission of a frame:
1. Normal operation
2. Loss of frame
3. Loss of ACK
4. Delay of ACK

MH 31 MH 32

2. Lost or damaged frame


3. Lost or delayed ACK

„ If next ACK arrives before expiration of


any timer then no retransmission
„ If next ACK arrives after timeout,
timeout the
frame and all later frames will be
retransmitted.

MH 33 MH 34

Sender window size Piggybacking

„ Go-back-N ARQ can also be


bidirectional and can also use
piggybacking
p ggy g to improve
p efficiency
y
„ In such a case, each direction needs
both sender window and a receiver
window
In Go-Back-N ARQ, the size of the
sender window must be less than 2m.

MH 35 MH 36

6
Selective Repeat ARQ Sender and Receiver windows
„ Control variables same as Go-back-N
„ Go-back-N ARQ „ Window size at most half of 2m (W <= 2m-1)
{ simplifies the process at receiver site
„ Receiver expects a “range” of frames
{ very inefficient for a noisy channel
„ -ve ACK (NAK) reports the sequence number
(resending many frames when only one
of the damaged frame
was damaged)
„ Selective Repeat ARQ
{ Processing at receiver is complex
{ More efficient for noisy links (resends
damaged frames only)
MH 37 MH 38

Lost frame
Sender and Receiver windows

MH 39 MH 40

Sender window size Piggybacking

„ Selective Repeat ARQ can also be


bidirectional and can also use
piggybacking
p ggy g to improve
p efficiency
y
„ In such a case, each direction needs
both sender window and a receiver
window

MH 41 MH 42

7
Bandwidth-Delay Product Example
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
„ Efficiency of an ARQ system can be is the bandwidth-delay product? If the system data frames
measured by the product of bandwidth are 1000 bits in length, what is the utilization percentage of
the link?
((bps)
p ) and round-trip
p delay
y ((sec))
Solution
„ It is a measure of the number of bits
The bandwidth-delay product is
that can be sent out of a system while
1 × 106 × 20 × 10-3 = 20,000 bits
waiting for ACKs
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
MH 43 delay,
MH use of Stop-and-Wait ARQ wastes the capacity of the link. 44

Example HDLC
What is the utilization percentage of the link in the
previous example if the link uses Go-Back-N ARQ „ Configurations and Transfer Modes
with a 15-frame sequence? „ Frame Format
Solution „ Frame Types
The bandwidth-delay product is still 20,000. The
„ Examples
system can send up to 15 frames or 15,000 bits during „ Data Transparency
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 frames have to be resent.
MH 45 MH 46

HDLC Configurations & Transfer Modes


1. NRM – Normal Response Mode
„ High-level Data Link Control
{ Station configuration is unbalanced
„ A bit-oriented protocol for
communication over point-to-point
point to point and
multipoint links.
„ It implements the ARQ mechanisms
discussed before

MH 47 MH 48

8
Configurations & Transfer Modes Frame Format
2. ABM – Asynchronous Balanced Mode
„ Each frame in HDLC may contain up
{ Station configuration is balanced
{ Point-to-point link
to 6 fields
{ Each station can function as primary and
secondary

Frame Check Sequence

MH 49 MH 50

Frame Format Frame Format

„ Flag Field „ Address Field


{ Contains an 8-bit sequence 01111110 { When primary/secondary configuration is
{ Used to identify beginning and end of a used, it contains address of the
frame secondary
d station
t ti
{ Serves as a synchronization pattern for { When primary/secondary configuration is
the receiver not used, it contains source and
{ In multiple frame transmissions, the destination addresses
ending flag of one frame can serve as the { All address bytes but the last one end
beginning flag of the next frame with 0, only the last byte ends with 1
MH 51 MH 52

Frame Format HDLC Frame Types

„ Control Field
{ 1 or 2 bytes for flow and error control
„ Information Field
{ Contains user data from network layer or
network management information
„ FCS Field
{ Contains 2 or 4 byte ITU-T CRC

MH 53 MH 54

9
I-frame (Information) S-frame (Supervisory)

„ Carries user data from network layer „ Used for flow and error control whenever
„ Can carry flow and error control information piggybacking can not be used
(piggybacking) „ Code field defines whether RR, RNR, REJ
or SREJ

MH 55 MH 56

U-frame (Unnumbered) U-frame control command and response


Command/response Meaning
SNRM Set normal response mode
SNRME Set normal response mode (extended)
SABM Set asynchronous balanced mode
SABME Set asynchronous balanced mode (extended)
UP Unnumbered poll
UI Unnumbered information
UA Unnumbered acknowledgment
RD Request disconnect
DISC Disconnect
DM Disconnect mode
RIM Request information mode
SIM Set initialization mode
RSET Reset
XID Exchange ID
FRMR Frame reject
MH 57 MH 58

Example 1 Example 2
In previous example,
suppose frame 1 sent
from station B to station
A has an error. Station A
informs station B to
resend frames 1 and 2
(the system is using the
Go-Back-N mechanism).
Station A sends a reject
supervisory frame to
announce the error in
frame 1.
MH 59 MH 60

10

You might also like