Data Link Layer
Data Link Layer
Data Link Layer
LAYER
Introduction
Functions of data link layer
4
Check notes "error detection"
Hamming Code
• Given by R. W. Hamming
• Error Detection and correction mechanism
• Easy to implement
• 7-bit hamming code used commonly
• Used to detect single bit errors which can also detect errors in two
consecutive bits but not more than that.
6
Calculation of Hamming code for data 1011
7
Calculation at receiver
8
Practice set
Q1. Assuming the even parity, find the parity bit for each data unit:
• 1001011
• 0001100
• 1000000
• 1110111
Q2. Find the LRC for block of data 10011001 01101111
Q3 Find Checksum bit sequence 1001001110010011 and
1001100001001101
Q4. Construct the hamming code for bit sequence 10011101
Q5. Calculate VRC and LRC for following bit pattern using even parity
0011101 1100111 1111111 0000000
9
Line Discipline
Who should send now?
Enquiry/ Acknowledgement
• Initiator first transmits a frame called an
Enquiry asking if the receiver is available
to receive data .
• The receiver must answer either with an
ACK or NAK (not ready to receive)
• If neither an ACK nor Nak is received
within specified time limit, the initiator
assumes that ENQ frame was lost in
transit, disconnects and sends
replacement.
• Once all data have been transmitted , the
sending system finishes with EOT frame.
Poll /Select
• One of devices is considered as primary
station and other devices are considered
as secondary stations.
• To solicit (ask for obtaining) transmission
from secondary to primary i.e. upstream,
then Poll mode is used. The primary device
basically controls and handles link or
connection and on the other hand,
secondary device simply follows its
instructions.
Poll /Select
20
Sliding Window Protocol
• When an acknowledgement arrives
• the sender moves LAR to right, thereby allowing the sender to transmit another
frame
• Also the sender associates a timer with each frame it transmits
• It retransmits the frame if the timer expires before the ACK is received
• Note that the sender has to be willing to buffer up to SWS frames WHY?
Receiver maintains three variables
• Receiving Window Size (RWS): Upper bound on the number of out-of-order frames
that the receiver is willing to accept
• Largest Acceptable Frame (LAF): Sequence number of the largest acceptable frame
• Last Frame Received (LFR):Sequence number of the last frame received
21
Sliding window Protocol
22
Character Oriented • Binary Synchronous communication (BSC) is a popular character-
Oriented Data Link protocol developed by IBM in 1964.
• Usable in both point-to-point and multipoint configurations.
• It supports half-duplex transmission using stop-and-wait ARQ flow
control and error correction.
• BSC does not support full-duplex transmission or sliding window
protocol.
• If a frame is used strictly for control purposes. It is called a control
frame, Control frames are used to exchange information between
communicating devices, for example : To establish the initial
connection, to control the flow of the transmission, to request error
corrections, and to disconnect the devices at the close of a session.
• If a frame contains part or all of the message data itself, It is called
a data frame. Data frames are used to transmit information, but
may also contain control information application to that information
BSC – sentinel approach
25
Fields of HDLC
• Flag − It is an 8-bit sequence that marks the beginning and the end of the frame. The bit pattern of the
flag is 01111110.
• Address − It contains the address of the receiver. If the frame is sent by the primary station, it contains
the address(es) of the secondary station(s). If it is sent by the secondary station, it contains the address
of the primary station. The address field may be from 1 byte to several bytes.
• Control − It is 1 or 2 bytes containing flow and error control information.
• Payload − This carries the data from the network layer. Its length may vary from one network to another.
• CRC − It is a 2 byte or 4 bytes frame check sequence for error detection. The standard code used is CRC
(cyclic redundancy code)
26
Types of HDLC Frames
• There are three types of HDLC frames. The type of frame is determined by the control
field of the frame −
• I-frame − I-frames or Information frames carry user data from the network layer. They
also include flow and error control information that is piggybacked on user data. The
first bit of control field of I-frame is 0.
• S-frame − S-frames or Supervisory frames do not contain information field. They are
used for flow and error control when piggybacking is not required. The first two bits of
control field of S-frame is 10.
• U-frame − U-frames or Un-numbered frames are used for myriad miscellaneous
functions, like link management. It may contain an information field, if required. The
first two bits of control field of U-frame is 11.
Reliable Transmission
Stop and Wait
Protocol
32
Sliding Window Protocol
• When an acknowledgement arrives
• the sender moves LAR to right, thereby allowing the sender to transmit another
frame
• Also the sender associates a timer with each frame it transmits
• It retransmits the frame if the timer expires before the ACK is received
• Note that the sender has to be willing to buffer up to SWS frames WHY?
Receiver maintains three variables
• Receiving Window Size (RWS): Upper bound on the number of out-of-order frames
that the receiver is willing to accept
• Largest Acceptable Frame (LAF): Sequence number of the largest acceptable frame
• Last Frame Received (LFR):Sequence number of the last frame received
33
Sliding window Protocol
34
35
Error Control
Error Control Techniques
Stop and wait
ARQ
Go back n-ARQ
38
Selective repeat ARQ
39
Multiple Access
Protocol
Introduction
• When a sender and receiver have a dedicated link to transmit data
packets, the data link control is enough to handle the channel.
• Suppose there is no dedicated path to communicate or transfer the
data between two devices. In that case, multiple stations access the
channel and simultaneously transmits the data over the channel.
• It may create collision and cross talk. Hence, the multiple access
protocol is required to reduce the collision and avoid crosstalk
between the channels.
Multiple access protocol
Random Access Protocol
• all the station has the equal priority to send the data over a channel.
• In random access protocol, one or more stations cannot depend on
another station nor any station control another station.
• Depending on the channel's state (idle or busy), each station
transmits the data frame.
• Following are the different methods of random-access protocols for
broadcasting frames on the channel.
• Aloha
• CSMA
• CSMA/CD
• CSMA/CA
Aloha