SlideShare a Scribd company logo
Prepared By: Kind Kishor
Tribhuvan University
Topics to be Included
1. Services provided to Network layer.
2. Framing.
3. Error detection methods: Parity, Checksum, CRC.
4. Data link protocols:
a. A simplex stop and wait protocol.
b. Sliding window protocols.
c. Go back and ARQ.
d. Selective repeat.
Data Link Layer:
Devices:- Switch, Bridge.
Services:- Framing, Flow control, Error control.
Functions of Data Link Layer:
Providing a well-defined service interface to the
network layer.
Dealing with transmission error.
Regulating the flow of data so that slow receivers are
not swamped by fast senders.
Services Provided to Network Layer
The principle service is transferring data from the network layer
on the source machine to the network layer on the destination
machine.
(a) Virtual communication.
(b) Actual communication.
Data Link Layer
Logical Link Control (LLC)
Layer
Media Access Control (MAC)
Layer
(The LLC is responsible for
flow control, error correction)
(The MAC layer is responsible for
providing a method for station to
gain access to medium)
Framing(1)
Framing is the process of breaking the bit stream up into
discrete frames.
DDL prepares a frame for transport across the local media by
encapsulating it with a header and trailer.
The data link layer frame includes:
Data: The packet from the network layer.Data: The packet from the network layer.
Header: contains control information (addressing) and located at
the beginning of frame.
Trailer: Contains control information added to the end of the
frame.
Framing(2)
Fixed-size Framing:
ӿ In fixed size framing, there is no need for defining the boundaries
of the frames.
ӿ The size of frame itself can be used as a delimiter.
Variable-size Framing:
ӿ In variable-size framing, we need a way to define the end of the
frame and the beginning of the frame.
ӿ There are two approaches used for this purpose:
a) A character-oriented approach.
b) A bit-oriented approach.
A character-oriented approach
Here, data are 8-bit characters from a coding system such
as ASCII.
The header and trailer are also multiples of 8-bits.
To separate one frame from next, an 8-bit flag is added atTo separate one frame from next, an 8-bit flag is added at
the end and beginning of the frame.
The flag, is composed of protocol-dependent special
characters, which signals the start and end of a frame.
A byte-stuffing strategy is used in character-oriented
framing.
Byte-Stuffing(Character-Stuffing)(1)
In this method, Frame starts & end with a special character that
mark the beginning & end of frame.
Each character begins with the ASCII character sequence DLE STX
(data link escape start of text ) and end with ASCII character
sequence DLE ETX (data link escape end of text).
DLE ASTX B DC ETXDLE
Start Of Frame Data End Of Frame
A B DC Data From Network Layer
Starting & Ending Characters Added By Link Layer
Byte-Stuffing(Character-Stuffing)(2)
DLE ASTX B DC ETXDLE
A B DCDLE
DLE DLE
data on Sender
side
DLE ASTX B DC ETXDLE
Start Of Frame Data End Of Frame
DLE DLE
A B DCDLE
data on
Reciever side
A bit-oriented approach
In this method, each frame begins & ends with a
special bit pattern 01111110 called flags.
There for each frame starts with 01111110 & also ends
with 01111110.
The main problem arises in this method when the flagThe main problem arises in this method when the flag
byte 01111110 appear as data.
This problem is handled by technique called bit
stuffing that is similar to character stuffing.
Bit-Stuffing
01 10 0 10 1 11 1 01 1001111110 01111110
Stuffing
Performed
By Data
Link layer
01 10 0 10 11 1 01 11 Data from network layer
Starting flag Bit
Ending Flag BIT
Shifted Bit
Link layer
01 10 0 10 1 11 1 01 1 Data received by
Network layer On
receiver side After
Performing De-stuffing
By data link Layer
Flow Control
● One of the most important functions of data link layer.
● A technique for assuring that a transmitting station does not
overwhelm a receiving station with data.
● A set of procedures that tells the sender how much data it can
transmit before it must wait for an acknowledgement from the
receiver.
●● Receiver has a limited speed at which it can process incoming data
and a limited amount of memory in which to store incoming data.
● Receiver must inform the sender before the limits are reached and
request that the transmitter to send fewer frames or stop
temporarily.
● Since the rate of processing is often slower than the rate of
transmission, receiver has a block of memory (buffer) for storing
incoming data until they are processed.
Stop and Wait Flow Control
Source transmits frame and waits for ACK before sending
next frame.
Destination receives frame and indicates its willingness to
accept another frame by sending back an acknowledgementaccept another frame by sending back an acknowledgement
with the frame just received.
Destination can stop flow by not sending ACK.
It works well for a few large frames.
It is inadequate for multiple frames for a single message
because only one frame at a time can be in transit.
Sliding-window Flow Control(1)
Allow multiple frames to be in transit at a time.
Receiver has allocates buffer space for n frames.
Transmitter can sent up to n frames without ACK.
Frames are numbered by assigning each frame a k-bit sequence
number and the range of sequence no is (0…….2^k-1).number and the range of sequence no is (0…….2^k-1).
ACK includes number of next frame expected.
This ACK announces that receiver is prepared to receive next n
frame.
The sequence numbers lists can be thought of as window of
frames.
Sliding-window Flow Control(2)
How flow control is achieved?
●Receiver can control the size of the sending window.●Receiver can control the size of the sending window.
● By limiting the size of the sending window data flow
from sender to receiver can be limited.
Error Control
ӿWhen data is transmitted over a channel, there is always a chance
that some of bits will be changed(corrupted) due to noise, signal
distortion, or attenuation.
ӿMechanisms to detect or correct errors that occur in the transmission
of frames.
ӿThere is possibility of two types of errors:ӿThere is possibility of two types of errors:
o Lost frame
o Damaged frame
ӿIt allows the receiver to inform the sender if a frame is lost or
damaged during transmission and coordinates the retransmission of
those frames by the sender.
ӿError control includes both error detection and error correction.
Error Detection
It allows a receiver to check whether received
data has been corrupted during the
transmission or not.transmission or not.
There three ways to detect errors:
•Parity check
•CRC
•Checksum
Parity Check
Single bit added to the end of the data.
Value of parity bit is such that data and parity have even
(even parity) or odd (odd parity) number of ones.
Typically, even parity is used for synchronous transmission
and odd parity is used for asynchronous transmission.
Even number of bit errors goes undetected.Even number of bit errors goes undetected.
It is example of even parity because
there are even number of 1s.
Cyclic Redundancy Check(CRC)
Consider the d-bit piece of data, D, that the sending node wants to send.
The sender and receiver must first agree on r+1 bit pattern, called generator,
which we will denote as G.
G must have the first and last bit equal to 1.
For D, the sender choose r additional bits, R, and append them to D.
The resulting d+r bit pattern is exactly divisible by G using modulo 2
arithmetic.arithmetic.
The receiver checks the error by dividing received d+r by G.
• If the remainder is non-zero, there is an error has occurred.
• Otherwise the data is correctly received.
Modulo 2 Arithmetic
Polynomial arithmetic is done modulo 2 using the rules of
algebraic field theory.
Both addition and subtraction are identical to exclusive OR.
For example:
10011011 11110000
+11001010 -10100110
-------------- -------------
01010001 01010110
Calculation of the
polynomial code
checksum.
Here generator
polynomial is
x^4+x+1.
Internet Checksum
The Internet has been using a 16-bit checksum.
Sender Site:
The message is divided into 16-bit words.
The value of checksum is set to be 0.
All words including the checksum are added using 1’s complement addition.
The sum is complement and becomes the checksum.
The checksum is sent with the data.
Receiver Site:
The message, including checksum, is divided into 16-bit words.
All words are added using 1’s complement addition.
The sum is complemented and becomes the new checksum.
If the value of checksum is zero;
The message is accepted.
Otherwise, it is rejected.
Error Correction
ӿIt allows a receiver to reconstruct the original
information when it has been corrupted during
transmission.
ӿWe can control the found errors in two ways:ӿWe can control the found errors in two ways:
Forward Error Correction(FEC):- FEC is accomplished by
adding redundancy to the transmitted information using a
predetermined algorithm.
Automatic Repeat Request(ARQ):- In ARQ, the receiver
detects transmission errors in a message and automatically
requests a retransmission from the transmitter. When the
transmitter receives the ARQ, it retransmits the message.
Hamming Distance
The number of bit positions in which two codewords differ is
called the Hamming distance between these two codewords.
The Hamming distance between two words( of same size) is the
number of differences between the corresponding bits.
It can easily be found if we apply the XOR operation on the two
words and count the numbers of 1’s in the result.words and count the numbers of 1’s in the result.
It is value greater than 0(zero).
10001001
10110001
00111000
Here Hamming distance = 3
Stop and Wait Protocol(1)
Based on the stop-and-wait flow
control technique.
The source station transmits a single
frame and then must wait for
ACK(acknowledgement).
The frames and ACK are numbered
0 & 1.0 & 1.
If frame 0 is received, ACK1 is sent,
and if frame 1 is received, ACK0 is
sent.
If no ACK received then the same
frame is sent again.
The receiver sends only positive ACK
for frame received safe and sound.
Stop and Wait Protocol(2)
Piggybacking:
It is a method to combine a
data frame with an
acknowledgement.
It is used when both station AIt is used when both station A
and B have data to send.
Here both station A and B send
data frame which also includes
an ACK.
It can save bandwidth of
channel because the data
frame and ACK frame can be
combined into just one frame.
Sliding Window Protocols
The basic idea of sliding window protocol is that
both sender and receiver keep a ``window'' of
acknowledgment.
The sender keeps the value of expectedThe sender keeps the value of expected
acknowledgment; while the receiver keeps the
value of expected receiving frame.
When sender receives an acknowledgment from the
receiver, it advances the window.
When receiver receives the expected frame, then it
advances the window.
One-bit sliding window
One bit sliding window protocol is also called
Stop-And-Wait protocol.
In this protocol, the sender sends out oneIn this protocol, the sender sends out one
frame, waits for acknowledgment before
sending next frame, thus the name Stop-And-
Wait.
Go-Back-N ARQ(1)
Based on sliding-window flow control.
Transmitter may send a series of frames
sequentially.
If no error, receiver sends ACK(RR=
receive ready), as usual, with next frame
expected.
Use window to control number ofUse window to control number of
outstanding frames.
If error, receiver sends a negative
ACK(REJ= reject) for that frame.
Receiver will discard that frame and all
future frames until the frame in error
received correctly.
Transmitter, when it receives REJ, must go
back and retransmit that frame and all
subsequent frames.
Go-Back-N ARQ(2)
Damaged frame:
Receiver detects error in frame i.
Receiver sends rejection-i.
Transmitter gets rejection-i.
Transmitter retransmits frame i and all subsequent.Transmitter retransmits frame i and all subsequent.
Lost frame(1):
Frame i lost.
Transmitter sends i+1.
Receiver gets frame i+1 out of sequence.
Receiver send reject i.
Transmitter retransmits frame i and all subsequent frames.
Go-Back-N ARQ(3)
Lost frame(2):
Frame i lost and no additional frame sent.
Receiver gets nothing and returns neither
acknowledgement nor rejection.acknowledgement nor rejection.
Transmitter times out and sends acknowledgement
frame with P bit set to 1(this is actually a command
for ACK request).
Receiver interprets this as command which it
acknowledges with the number of the next frame it
expects (frame i ).
Transmitter then retransmits frame i.
Go-Back-N ARQ(4)
Damaged acknowledgement(RR):
Receiver gets frame i and send acknowledgement (i+1)
which is lost.
Acknowledgements are cumulative, so next
acknowledgement (i+n) may arrive before transmitter times
out on frame i.out on frame i.
If transmitter times out, it sends acknowledgement with P bit
set as before.
This can be repeated a number of times before a reset
procedure is initiated
Damaged rejection(REJ):
As for lost frame.
Selective Reject ARQ
●Also called selective retransmission.
●Only rejected(negative ACK, or time-out)
frames are retransmitted.
●Minimizes amount of retransmission.
●Subsequent frames are accepted by the
receiver and buffered.
●Receiver must maintain large enough●Receiver must maintain large enough
buffer to save received frames until the
frame in error is retransmitted.
●Receiver must contain logic for
reinserting that frame is the proper
sequence.
●More complex logic in transmitter
because it is much less used than go-
back-n ARQ.
Unit 4 data link layer
Unit 4 data link layer

More Related Content

What's hot

Flow & Error Control
Flow & Error ControlFlow & Error Control
Flow & Error Control
tameemyousaf
 
Packet switching
Packet switchingPacket switching
Packet switching
asimnawaz54
 
Circuit and packet_switching
Circuit and packet_switchingCircuit and packet_switching
Circuit and packet_switching
hoanv
 
Switching techniques
Switching techniquesSwitching techniques
Switching techniques
Gupta6Bindu
 

What's hot (20)

Presentation Routing algorithm
Presentation Routing algorithmPresentation Routing algorithm
Presentation Routing algorithm
 
Circuit Switching, Packet Switching, Virtual Circuit Networks and Datagram Ne...
Circuit Switching, Packet Switching, Virtual Circuit Networks and Datagram Ne...Circuit Switching, Packet Switching, Virtual Circuit Networks and Datagram Ne...
Circuit Switching, Packet Switching, Virtual Circuit Networks and Datagram Ne...
 
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
 
Flow & Error Control
Flow & Error ControlFlow & Error Control
Flow & Error Control
 
Mobile Transport layer
Mobile Transport layerMobile Transport layer
Mobile Transport layer
 
Packet switching
Packet switchingPacket switching
Packet switching
 
Multiple access protocol
Multiple access protocolMultiple access protocol
Multiple access protocol
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion Avoidance
 
Network Layer,Computer Networks
Network Layer,Computer NetworksNetwork Layer,Computer Networks
Network Layer,Computer Networks
 
Circuit and packet_switching
Circuit and packet_switchingCircuit and packet_switching
Circuit and packet_switching
 
Transport layer
Transport layer Transport layer
Transport layer
 
Transport layer services
Transport layer servicesTransport layer services
Transport layer services
 
Network layer - design Issues
Network layer - design IssuesNetwork layer - design Issues
Network layer - design Issues
 
Switching techniques
Switching techniquesSwitching techniques
Switching techniques
 
Circuit Switching
Circuit SwitchingCircuit Switching
Circuit Switching
 
Simplex stop and_wait_protocol
Simplex stop and_wait_protocolSimplex stop and_wait_protocol
Simplex stop and_wait_protocol
 
Error control
Error controlError control
Error control
 
TCP-IP Reference Model
TCP-IP Reference ModelTCP-IP Reference Model
TCP-IP Reference Model
 
User datagram protocol (udp)
User datagram protocol (udp)User datagram protocol (udp)
User datagram protocol (udp)
 
Application Layer
Application Layer Application Layer
Application Layer
 

Viewers also liked

CCNA Exploration 1 - Chapter 5
CCNA Exploration 1 - Chapter 5CCNA Exploration 1 - Chapter 5
CCNA Exploration 1 - Chapter 5
Irsandi Hasan
 
CCNA Exploration 1 - Chapter 9
CCNA Exploration 1 - Chapter 9CCNA Exploration 1 - Chapter 9
CCNA Exploration 1 - Chapter 9
Irsandi Hasan
 
CCNA Exploration 1 - Chapter 7
CCNA Exploration 1 - Chapter 7CCNA Exploration 1 - Chapter 7
CCNA Exploration 1 - Chapter 7
Irsandi Hasan
 

Viewers also liked (11)

Data link layer
Data link layer Data link layer
Data link layer
 
Broadband isdn
Broadband isdnBroadband isdn
Broadband isdn
 
The Data Link Layer
The Data Link LayerThe Data Link Layer
The Data Link Layer
 
FDDI
FDDIFDDI
FDDI
 
Network Fundamentals: Ch7 - Data Link Layer
Network Fundamentals: Ch7 - Data Link LayerNetwork Fundamentals: Ch7 - Data Link Layer
Network Fundamentals: Ch7 - Data Link Layer
 
Fddi
FddiFddi
Fddi
 
CCNA Exploration 1 - Chapter 5
CCNA Exploration 1 - Chapter 5CCNA Exploration 1 - Chapter 5
CCNA Exploration 1 - Chapter 5
 
Chapter3
Chapter3Chapter3
Chapter3
 
CCNA Exploration 1 - Chapter 9
CCNA Exploration 1 - Chapter 9CCNA Exploration 1 - Chapter 9
CCNA Exploration 1 - Chapter 9
 
CCNA Exploration 1 - Chapter 7
CCNA Exploration 1 - Chapter 7CCNA Exploration 1 - Chapter 7
CCNA Exploration 1 - Chapter 7
 
Data Link Layer
Data Link LayerData Link Layer
Data Link Layer
 

Similar to Unit 4 data link layer

U2CH1Data Link Layerxxxxxxxxxxxxxxxxx.pptx
U2CH1Data Link Layerxxxxxxxxxxxxxxxxx.pptxU2CH1Data Link Layerxxxxxxxxxxxxxxxxx.pptx
U2CH1Data Link Layerxxxxxxxxxxxxxxxxx.pptx
k2w9psdb96
 
datalinklayermukesh-150130061041-conversion-gate01.pptx
datalinklayermukesh-150130061041-conversion-gate01.pptxdatalinklayermukesh-150130061041-conversion-gate01.pptx
datalinklayermukesh-150130061041-conversion-gate01.pptx
lathass5
 

Similar to Unit 4 data link layer (20)

chp2 - data link layer.pptx
chp2 - data link layer.pptxchp2 - data link layer.pptx
chp2 - data link layer.pptx
 
Introduction to data link layer
Introduction to data link layerIntroduction to data link layer
Introduction to data link layer
 
Jaimin chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batchJaimin   chp-3 - data-link layer- 2011 batch
Jaimin chp-3 - data-link layer- 2011 batch
 
data link layer - Chapter 3
data link layer - Chapter 3data link layer - Chapter 3
data link layer - Chapter 3
 
5 DLL-LLC- Book
5 DLL-LLC- Book5 DLL-LLC- Book
5 DLL-LLC- Book
 
Data link layer tutorial
Data link layer tutorialData link layer tutorial
Data link layer tutorial
 
III_UNIT_ErrorCorrecting.pptx
III_UNIT_ErrorCorrecting.pptxIII_UNIT_ErrorCorrecting.pptx
III_UNIT_ErrorCorrecting.pptx
 
Unit 2 [autosaved]
Unit 2 [autosaved]Unit 2 [autosaved]
Unit 2 [autosaved]
 
data link layer to print
data link layer to printdata link layer to print
data link layer to print
 
Different protocols for data communication networks
Different protocols for data communication networks Different protocols for data communication networks
Different protocols for data communication networks
 
Chapter 2.1.1.pptx
Chapter 2.1.1.pptxChapter 2.1.1.pptx
Chapter 2.1.1.pptx
 
Unit 2
Unit 2Unit 2
Unit 2
 
DLL
DLLDLL
DLL
 
U2CH1Data Link Layerxxxxxxxxxxxxxxxxx.pptx
U2CH1Data Link Layerxxxxxxxxxxxxxxxxx.pptxU2CH1Data Link Layerxxxxxxxxxxxxxxxxx.pptx
U2CH1Data Link Layerxxxxxxxxxxxxxxxxx.pptx
 
Nigga.pdf
Nigga.pdfNigga.pdf
Nigga.pdf
 
Unit 3 - Data Link Layer - Part A
Unit 3 - Data Link Layer - Part AUnit 3 - Data Link Layer - Part A
Unit 3 - Data Link Layer - Part A
 
datalinklayermukesh
datalinklayermukeshdatalinklayermukesh
datalinklayermukesh
 
Data communication network ppt_Unit_4.pptx
Data communication network ppt_Unit_4.pptxData communication network ppt_Unit_4.pptx
Data communication network ppt_Unit_4.pptx
 
Unit 2 data link control
Unit 2 data link controlUnit 2 data link control
Unit 2 data link control
 
datalinklayermukesh-150130061041-conversion-gate01.pptx
datalinklayermukesh-150130061041-conversion-gate01.pptxdatalinklayermukesh-150130061041-conversion-gate01.pptx
datalinklayermukesh-150130061041-conversion-gate01.pptx
 

Recently uploaded

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptx
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptx
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 

Unit 4 data link layer

  • 1. Prepared By: Kind Kishor Tribhuvan University
  • 2. Topics to be Included 1. Services provided to Network layer. 2. Framing. 3. Error detection methods: Parity, Checksum, CRC. 4. Data link protocols: a. A simplex stop and wait protocol. b. Sliding window protocols. c. Go back and ARQ. d. Selective repeat.
  • 3. Data Link Layer: Devices:- Switch, Bridge. Services:- Framing, Flow control, Error control. Functions of Data Link Layer: Providing a well-defined service interface to the network layer. Dealing with transmission error. Regulating the flow of data so that slow receivers are not swamped by fast senders.
  • 4. Services Provided to Network Layer The principle service is transferring data from the network layer on the source machine to the network layer on the destination machine. (a) Virtual communication. (b) Actual communication.
  • 5. Data Link Layer Logical Link Control (LLC) Layer Media Access Control (MAC) Layer (The LLC is responsible for flow control, error correction) (The MAC layer is responsible for providing a method for station to gain access to medium)
  • 6. Framing(1) Framing is the process of breaking the bit stream up into discrete frames. DDL prepares a frame for transport across the local media by encapsulating it with a header and trailer. The data link layer frame includes: Data: The packet from the network layer.Data: The packet from the network layer. Header: contains control information (addressing) and located at the beginning of frame. Trailer: Contains control information added to the end of the frame.
  • 7. Framing(2) Fixed-size Framing: ӿ In fixed size framing, there is no need for defining the boundaries of the frames. ӿ The size of frame itself can be used as a delimiter. Variable-size Framing: ӿ In variable-size framing, we need a way to define the end of the frame and the beginning of the frame. ӿ There are two approaches used for this purpose: a) A character-oriented approach. b) A bit-oriented approach.
  • 8. A character-oriented approach Here, data are 8-bit characters from a coding system such as ASCII. The header and trailer are also multiples of 8-bits. To separate one frame from next, an 8-bit flag is added atTo separate one frame from next, an 8-bit flag is added at the end and beginning of the frame. The flag, is composed of protocol-dependent special characters, which signals the start and end of a frame. A byte-stuffing strategy is used in character-oriented framing.
  • 9. Byte-Stuffing(Character-Stuffing)(1) In this method, Frame starts & end with a special character that mark the beginning & end of frame. Each character begins with the ASCII character sequence DLE STX (data link escape start of text ) and end with ASCII character sequence DLE ETX (data link escape end of text). DLE ASTX B DC ETXDLE Start Of Frame Data End Of Frame A B DC Data From Network Layer Starting & Ending Characters Added By Link Layer
  • 10. Byte-Stuffing(Character-Stuffing)(2) DLE ASTX B DC ETXDLE A B DCDLE DLE DLE data on Sender side DLE ASTX B DC ETXDLE Start Of Frame Data End Of Frame DLE DLE A B DCDLE data on Reciever side
  • 11. A bit-oriented approach In this method, each frame begins & ends with a special bit pattern 01111110 called flags. There for each frame starts with 01111110 & also ends with 01111110. The main problem arises in this method when the flagThe main problem arises in this method when the flag byte 01111110 appear as data. This problem is handled by technique called bit stuffing that is similar to character stuffing.
  • 12. Bit-Stuffing 01 10 0 10 1 11 1 01 1001111110 01111110 Stuffing Performed By Data Link layer 01 10 0 10 11 1 01 11 Data from network layer Starting flag Bit Ending Flag BIT Shifted Bit Link layer 01 10 0 10 1 11 1 01 1 Data received by Network layer On receiver side After Performing De-stuffing By data link Layer
  • 13. Flow Control ● One of the most important functions of data link layer. ● A technique for assuring that a transmitting station does not overwhelm a receiving station with data. ● A set of procedures that tells the sender how much data it can transmit before it must wait for an acknowledgement from the receiver. ●● Receiver has a limited speed at which it can process incoming data and a limited amount of memory in which to store incoming data. ● Receiver must inform the sender before the limits are reached and request that the transmitter to send fewer frames or stop temporarily. ● Since the rate of processing is often slower than the rate of transmission, receiver has a block of memory (buffer) for storing incoming data until they are processed.
  • 14. Stop and Wait Flow Control Source transmits frame and waits for ACK before sending next frame. Destination receives frame and indicates its willingness to accept another frame by sending back an acknowledgementaccept another frame by sending back an acknowledgement with the frame just received. Destination can stop flow by not sending ACK. It works well for a few large frames. It is inadequate for multiple frames for a single message because only one frame at a time can be in transit.
  • 15. Sliding-window Flow Control(1) Allow multiple frames to be in transit at a time. Receiver has allocates buffer space for n frames. Transmitter can sent up to n frames without ACK. Frames are numbered by assigning each frame a k-bit sequence number and the range of sequence no is (0…….2^k-1).number and the range of sequence no is (0…….2^k-1). ACK includes number of next frame expected. This ACK announces that receiver is prepared to receive next n frame. The sequence numbers lists can be thought of as window of frames.
  • 17. How flow control is achieved? ●Receiver can control the size of the sending window.●Receiver can control the size of the sending window. ● By limiting the size of the sending window data flow from sender to receiver can be limited.
  • 18. Error Control ӿWhen data is transmitted over a channel, there is always a chance that some of bits will be changed(corrupted) due to noise, signal distortion, or attenuation. ӿMechanisms to detect or correct errors that occur in the transmission of frames. ӿThere is possibility of two types of errors:ӿThere is possibility of two types of errors: o Lost frame o Damaged frame ӿIt allows the receiver to inform the sender if a frame is lost or damaged during transmission and coordinates the retransmission of those frames by the sender. ӿError control includes both error detection and error correction.
  • 19. Error Detection It allows a receiver to check whether received data has been corrupted during the transmission or not.transmission or not. There three ways to detect errors: •Parity check •CRC •Checksum
  • 20. Parity Check Single bit added to the end of the data. Value of parity bit is such that data and parity have even (even parity) or odd (odd parity) number of ones. Typically, even parity is used for synchronous transmission and odd parity is used for asynchronous transmission. Even number of bit errors goes undetected.Even number of bit errors goes undetected. It is example of even parity because there are even number of 1s.
  • 21. Cyclic Redundancy Check(CRC) Consider the d-bit piece of data, D, that the sending node wants to send. The sender and receiver must first agree on r+1 bit pattern, called generator, which we will denote as G. G must have the first and last bit equal to 1. For D, the sender choose r additional bits, R, and append them to D. The resulting d+r bit pattern is exactly divisible by G using modulo 2 arithmetic.arithmetic. The receiver checks the error by dividing received d+r by G. • If the remainder is non-zero, there is an error has occurred. • Otherwise the data is correctly received.
  • 22. Modulo 2 Arithmetic Polynomial arithmetic is done modulo 2 using the rules of algebraic field theory. Both addition and subtraction are identical to exclusive OR. For example: 10011011 11110000 +11001010 -10100110 -------------- ------------- 01010001 01010110
  • 23. Calculation of the polynomial code checksum. Here generator polynomial is x^4+x+1.
  • 24. Internet Checksum The Internet has been using a 16-bit checksum. Sender Site: The message is divided into 16-bit words. The value of checksum is set to be 0. All words including the checksum are added using 1’s complement addition. The sum is complement and becomes the checksum. The checksum is sent with the data. Receiver Site: The message, including checksum, is divided into 16-bit words. All words are added using 1’s complement addition. The sum is complemented and becomes the new checksum. If the value of checksum is zero; The message is accepted. Otherwise, it is rejected.
  • 25. Error Correction ӿIt allows a receiver to reconstruct the original information when it has been corrupted during transmission. ӿWe can control the found errors in two ways:ӿWe can control the found errors in two ways: Forward Error Correction(FEC):- FEC is accomplished by adding redundancy to the transmitted information using a predetermined algorithm. Automatic Repeat Request(ARQ):- In ARQ, the receiver detects transmission errors in a message and automatically requests a retransmission from the transmitter. When the transmitter receives the ARQ, it retransmits the message.
  • 26. Hamming Distance The number of bit positions in which two codewords differ is called the Hamming distance between these two codewords. The Hamming distance between two words( of same size) is the number of differences between the corresponding bits. It can easily be found if we apply the XOR operation on the two words and count the numbers of 1’s in the result.words and count the numbers of 1’s in the result. It is value greater than 0(zero). 10001001 10110001 00111000 Here Hamming distance = 3
  • 27. Stop and Wait Protocol(1) Based on the stop-and-wait flow control technique. The source station transmits a single frame and then must wait for ACK(acknowledgement). The frames and ACK are numbered 0 & 1.0 & 1. If frame 0 is received, ACK1 is sent, and if frame 1 is received, ACK0 is sent. If no ACK received then the same frame is sent again. The receiver sends only positive ACK for frame received safe and sound.
  • 28. Stop and Wait Protocol(2) Piggybacking: It is a method to combine a data frame with an acknowledgement. It is used when both station AIt is used when both station A and B have data to send. Here both station A and B send data frame which also includes an ACK. It can save bandwidth of channel because the data frame and ACK frame can be combined into just one frame.
  • 29. Sliding Window Protocols The basic idea of sliding window protocol is that both sender and receiver keep a ``window'' of acknowledgment. The sender keeps the value of expectedThe sender keeps the value of expected acknowledgment; while the receiver keeps the value of expected receiving frame. When sender receives an acknowledgment from the receiver, it advances the window. When receiver receives the expected frame, then it advances the window.
  • 30. One-bit sliding window One bit sliding window protocol is also called Stop-And-Wait protocol. In this protocol, the sender sends out oneIn this protocol, the sender sends out one frame, waits for acknowledgment before sending next frame, thus the name Stop-And- Wait.
  • 31. Go-Back-N ARQ(1) Based on sliding-window flow control. Transmitter may send a series of frames sequentially. If no error, receiver sends ACK(RR= receive ready), as usual, with next frame expected. Use window to control number ofUse window to control number of outstanding frames. If error, receiver sends a negative ACK(REJ= reject) for that frame. Receiver will discard that frame and all future frames until the frame in error received correctly. Transmitter, when it receives REJ, must go back and retransmit that frame and all subsequent frames.
  • 32. Go-Back-N ARQ(2) Damaged frame: Receiver detects error in frame i. Receiver sends rejection-i. Transmitter gets rejection-i. Transmitter retransmits frame i and all subsequent.Transmitter retransmits frame i and all subsequent. Lost frame(1): Frame i lost. Transmitter sends i+1. Receiver gets frame i+1 out of sequence. Receiver send reject i. Transmitter retransmits frame i and all subsequent frames.
  • 33. Go-Back-N ARQ(3) Lost frame(2): Frame i lost and no additional frame sent. Receiver gets nothing and returns neither acknowledgement nor rejection.acknowledgement nor rejection. Transmitter times out and sends acknowledgement frame with P bit set to 1(this is actually a command for ACK request). Receiver interprets this as command which it acknowledges with the number of the next frame it expects (frame i ). Transmitter then retransmits frame i.
  • 34. Go-Back-N ARQ(4) Damaged acknowledgement(RR): Receiver gets frame i and send acknowledgement (i+1) which is lost. Acknowledgements are cumulative, so next acknowledgement (i+n) may arrive before transmitter times out on frame i.out on frame i. If transmitter times out, it sends acknowledgement with P bit set as before. This can be repeated a number of times before a reset procedure is initiated Damaged rejection(REJ): As for lost frame.
  • 35. Selective Reject ARQ ●Also called selective retransmission. ●Only rejected(negative ACK, or time-out) frames are retransmitted. ●Minimizes amount of retransmission. ●Subsequent frames are accepted by the receiver and buffered. ●Receiver must maintain large enough●Receiver must maintain large enough buffer to save received frames until the frame in error is retransmitted. ●Receiver must contain logic for reinserting that frame is the proper sequence. ●More complex logic in transmitter because it is much less used than go- back-n ARQ.