Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Data Link Layer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 56

DATA LINK

LAYER
Introduction
Functions of data link layer

DLL is responsible for moving


data frames from one node to
another.
Framing (MAC)
Physical Addressing (MAC)
Flow control (LLC)
Error Control (MAC)
Access Control (MAC)
3
Error Types

• Single Bit : The only one bit of


a given data unit is changed
from 1 to 0 or from 0 to 1.
• Burst Error: The two or more
bits are changed from 0 to 1
or from 1 to 0 is known as
Burst Error. The Burst Error is
determined from the first
corrupted bit to the last
corrupted bit.

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.

• Hamming Distance: number of bits where 2 data strings differ.

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

• When primary station wants to


transmit something to
secondary station i.e.
downstream, then Select mode
is used.
Flow control
• Transmission is said to be reliable if the frame is
received at receiver properly (free of error and
delivered properly)
• This is accomplished using a combination of two
fundamental mechanisms
• Acknowledgements and Timeouts
Reliable • An acknowledgement (ACK for short) is a small
control frame that a protocol sends back to its peer
Transmission saying that it has received the earlier frame.
• A control frame is a frame with header only (no
data).
• The receipt of an acknowledgement indicates to the
sender of the original frame that its frame was
successfully delivered.
Reliable
Transmission
Stop and Wait
Protocol

Timeline showing four different scenarios for the stop-and-wait algorithm.


(a) The ACK is received before the timer expires; (b) the original frame is lost;
(c) the ACK is lost; (d) the timeout fires too soon
Stop and Wait
• If the acknowledgment is lost or delayed in arriving
• The sender times out and retransmits the original frame,
but the receiver will think that it is the next frame since it
has correctly received and acknowledged the first frame
• As a result, duplicate copies of frames will be delivered
• How to solve this :- Use 1 bit sequence number (0 or 1)
• When the sender retransmits frame 0, the receiver can
determine that it is seeing a second copy of frame 0
rather than the first copy of frame 1 and therefore can
ignore it (the receiver still acknowledges it, in case the
first acknowledgement was lost)
Sliding Window
Protocol
Sender assigns a sequence number denoted as SeqNum
to each frame. Assume it can grow infinitely large. Sender
maintains three variables
• Sending Window Size (SWS): Upper bound on the
number of outstanding (unacknowledged) frames that
the sender can transmit
• Last Acknowledgement Received (LAR) : Sequence
number of the last acknowledgement received
• Last Frame Sent (LFS) : Sequence number of the last
frame sent
Sliding
Window
Sender also maintains the
following invariant
• LFS – LAR ≤ SWS
Receiver also maintains the
following invariant
• LAF – LFR ≤ RWS

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

• Frames transmitted beginning with


leftmost field
• Beginning of a frame is denoted by
sending a special SYN (synchronize)
character
• Data portion of the frame is contained BISYNC Frame Format
between special sentinel character STX
(start of text) and ETX (end of text)
• SOH : Start of Header
• DLE : Data Link Escape
• CRC: Cyclic Redundancy Check
Bit Oriented protocol

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

Timeline showing four different scenarios for the stop-and-wait algorithm.


(a) The ACK is received before the timer expires; (b) the original frame is lost;
(c) the ACK is lost; (d) the timeout fires too soon
Stop and Wait
• If the acknowledgment is lost or delayed in arriving
• The sender times out and retransmits the original frame,
but the receiver will think that it is the next frame since it
has correctly received and acknowledged the first frame
• As a result, duplicate copies of frames will be delivered
• How to solve this :- Use 1 bit sequence number (0 or 1)
• When the sender retransmits frame 0, the receiver can
determine that it is seeing a second copy of frame 0
rather than the first copy of frame 1 and therefore can
ignore it (the receiver still acknowledges it, in case the
first acknowledgement was lost)
Sliding Window
Protocol
Sender assigns a sequence number denoted as SeqNum
to each frame. Assume it can grow infinitely large. Sender
maintains three variables
• Sending Window Size (SWS): Upper bound on the
number of outstanding (unacknowledged) frames that
the sender can transmit
• Last Acknowledgement Received (LAR) : Sequence
number of the last acknowledgement received
• Last Frame Sent (LFS) : Sequence number of the last
frame sent
Sliding
Window
Sender also maintains the
following invariant
• LFS – LAR ≤ SWS
Receiver also maintains the
following invariant
• LAF – LFR ≤ RWS

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

1.Any station can transmit data to a


channel at any time.
2.It does not require any carrier sensing.
3.Collision and data frames may be lost
during the transmission of data through
multiple stations.
4.Acknowledgment of the frames exists in
Aloha. Hence, there is no collision
detection.
5.It requires retransmission of data after
some random amount of time.
Pure Aloha
Slotted Aloha

• The slotted Aloha is designed to


overcome the pure Aloha's
efficiency because pure Aloha has
a very high possibility of frame
hitting.
• In slotted Aloha, the shared
channel is divided into a fixed time
interval called slots. So that, if a
station wants to send a frame to a
shared channel, the frame can
only be sent at the beginning of
the slot, and only one frame is
allowed to be sent to each slot.
Carrier Sense Multiple Access

• sense the traffic on a channel (idle


or busy) before transmitting the
data.
• It means that if the channel is idle,
the station can send data to the
channel. Otherwise, it must wait
until the channel becomes idle.
• Hence, it reduces the chances of
a collision on a transmission
medium.
CSMA modes

• In the 1-Persistent mode of CSMA that defines


each node, first sense the shared channel and
if the channel is idle, it immediately sends the
data. Else it must wait and keep track of the
status of the channel to be idle and broadcast
the frame unconditionally as soon as the
channel is idle.
• Non persistent It is the access mode of CSMA
that defines before transmitting the data, each
node must sense the channel, and if the
channel is inactive, it immediately sends the
data. Otherwise, the station must wait for a
random time (not continuously), and when the
channel is found to be idle, it transmits the
frames.
CSMA modes
• It is the combination of 1-Persistent and Non-persistent modes. The P-
Persistent mode defines that each node senses the channel, and if
the channel is inactive, it sends a frame with a P probability. If the data
is not transmitted, it waits for a (q = 1-p probability) random time and
resumes the frame with the next time slot.
• O- Persistent: It is an O-persistent method that defines the superiority
of the station before the transmission of the frame on the shared
channel. If it is found that the channel is inactive, each station waits for
its turn to retransmit the data.
carrier sense multiple access/ collision detection -
CSMA/CD
• It first senses the shared channel before broadcasting the frames, and
if the channel is idle, it transmits a frame to check whether the
transmission was successful.
• If the frame is successfully received, the station sends another frame.
If any collision is detected in the CSMA/CD, the station sends a jam/
stop signal to the shared channel to terminate data transmission. After
that, it waits for a random time before sending a frame to a channel.
carrier sense multiple access/ collision Avoidance –
CSMA/CA
• When a data frame is sent to a channel, it receives an
acknowledgment to check whether the channel is clear.
• If the station receives only a single (own) acknowledgments, that
means the data frame has been successfully transmitted to the
receiver. But if it gets two signals (its own and one more in which the
collision of frames), a collision of the frame occurs in the shared
channel.
• Detects the collision of the frame when a sender receives an
acknowledgment signal.
• Following are the methods used in the CSMA/ CA to avoid the
collision:
• Interframe Space
• Contention window
• Acknowledgement
Multiple access protocol
Frequency Division Multiple Access

• FDMA is a type of channelization protocol.


In this bandwidth is divided into various
frequency bands. Each station is allocated
with band to send data and that band is
reserve
• The frequency bands of different stations
are separated by small band of unused
frequency and that unused frequency
bands are called as guard bands that
prevents the interference of stations.ed for
particular station for all the time
Time Division Multiple Access (TDMA)
• TDMA is the channelization
protocol in which
bandwidth of channel is
divided into various
stations on the time basis.
There is a time slot given to
each station, the station
can transmit data during
that time slot
Code Division Multiple Access
• In CDMA, all the stations can
transmit data simultaneously. It
allows each station to transmit
data over the entire frequency all
the time.
• Multiple simultaneous
transmissions are separated by
unique code sequence. Each user
is assigned with a unique code
sequence.
Multiple access protocol

You might also like