Unit 4 data link layer

mekind
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
1 von 37

Recomendados

Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS von
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSComputer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSDr. SELVAGANESAN S
3.1K views201 Folien
data-link layer protocols von
data-link layer protocols  data-link layer protocols
data-link layer protocols BE Smârt
13.3K views49 Folien
Traffic and Congestion Control in ATM Networks Chapter 13 von
Traffic and Congestion Control in ATM Networks Chapter 13Traffic and Congestion Control in ATM Networks Chapter 13
Traffic and Congestion Control in ATM Networks Chapter 13daniel ayalew
1.8K views87 Folien
Data Link Layer| Error Detection von
Data Link Layer| Error DetectionData Link Layer| Error Detection
Data Link Layer| Error DetectionTaimoor Muzaffar Gondal
2K views21 Folien
HDLC von
HDLCHDLC
HDLCNewcovenant Muro
11.4K views15 Folien
Chapter 4 data link layer von
Chapter 4 data link layerChapter 4 data link layer
Chapter 4 data link layerNaiyan Noor
12.9K views61 Folien

Más contenido relacionado

Was ist angesagt?

Network layer tanenbaum von
Network layer tanenbaumNetwork layer tanenbaum
Network layer tanenbaumMahesh Kumar Chelimilla
4.6K views83 Folien
Unit 1 introduction to computer networks von
Unit 1  introduction to computer networksUnit 1  introduction to computer networks
Unit 1 introduction to computer networkspavan kumar Thatikonda
29.9K views101 Folien
Computer Network - Network Layer von
Computer Network - Network LayerComputer Network - Network Layer
Computer Network - Network LayerManoj Kumar
9.9K views91 Folien
Routing algorithm von
Routing algorithmRouting algorithm
Routing algorithmBushra M
35.7K views44 Folien
Network Layer,Computer Networks von
Network Layer,Computer NetworksNetwork Layer,Computer Networks
Network Layer,Computer Networksguesta81d4b
49K views80 Folien
Sliding window protocol von
Sliding window protocolSliding window protocol
Sliding window protocolShehara Abeythunga
38.9K views15 Folien

Was ist angesagt?(20)

Computer Network - Network Layer von Manoj Kumar
Computer Network - Network LayerComputer Network - Network Layer
Computer Network - Network Layer
Manoj Kumar9.9K views
Routing algorithm von Bushra M
Routing algorithmRouting algorithm
Routing algorithm
Bushra M35.7K views
Network Layer,Computer Networks von guesta81d4b
Network Layer,Computer NetworksNetwork Layer,Computer Networks
Network Layer,Computer Networks
guesta81d4b49K views
Destination Sequenced Distance Vector Routing (DSDV) von Arun Chokkalingam
Destination Sequenced Distance Vector Routing (DSDV)Destination Sequenced Distance Vector Routing (DSDV)
Destination Sequenced Distance Vector Routing (DSDV)
Arun Chokkalingam2.3K views
Flow & Error Control von tameemyousaf
Flow & Error ControlFlow & Error Control
Flow & Error Control
tameemyousaf38.3K views
Chapter 1: Introduction to Data Communication and Networks von Shafaan Khaliq Bhatti
Chapter 1: Introduction to Data Communication and NetworksChapter 1: Introduction to Data Communication and Networks
Chapter 1: Introduction to Data Communication and Networks
Shafaan Khaliq Bhatti93.8K views
Transport layer von reshmadayma
Transport layerTransport layer
Transport layer
reshmadayma10.3K views

Destacado

Broadband isdn von
Broadband isdnBroadband isdn
Broadband isdnEr Varun Kumar
25.2K views18 Folien
The Data Link Layer von
The Data Link LayerThe Data Link Layer
The Data Link Layerrobbbminson
13.7K views166 Folien
FDDI von
FDDIFDDI
FDDIGracie Nikka
11K views20 Folien
Network Fundamentals: Ch7 - Data Link Layer von
Network Fundamentals: Ch7 - Data Link LayerNetwork Fundamentals: Ch7 - Data Link Layer
Network Fundamentals: Ch7 - Data Link LayerAbdelkhalik Mosa
4K views31 Folien
Fddi von
FddiFddi
FddiAnuj Gupta
21.7K views11 Folien
CCNA Exploration 1 - Chapter 5 von
CCNA Exploration 1 - Chapter 5CCNA Exploration 1 - Chapter 5
CCNA Exploration 1 - Chapter 5Irsandi Hasan
3.5K views27 Folien

Destacado(10)

Similar a Unit 4 data link layer

chp2 - data link layer.pptx von
chp2 - data link layer.pptxchp2 - data link layer.pptx
chp2 - data link layer.pptxChakra Pani
15 views73 Folien
Introduction to data link layer von
Introduction to data link layerIntroduction to data link layer
Introduction to data link layerShashank HP
96 views16 Folien
Jaimin chp-3 - data-link layer- 2011 batch von
Jaimin   chp-3 - data-link layer- 2011 batchJaimin   chp-3 - data-link layer- 2011 batch
Jaimin chp-3 - data-link layer- 2011 batchJaimin Jani
3.6K views292 Folien
data link layer - Chapter 3 von
data link layer - Chapter 3data link layer - Chapter 3
data link layer - Chapter 3SakthiVinoth78
71 views46 Folien
5 DLL-LLC- Book von
5 DLL-LLC- Book5 DLL-LLC- Book
5 DLL-LLC- BookWater Birds (Ali)
1K views50 Folien
Data link layer tutorial von
Data link layer tutorialData link layer tutorial
Data link layer tutorialSwapnadeep Reloaded
1.1K views8 Folien

Similar a Unit 4 data link layer(20)

chp2 - data link layer.pptx von Chakra Pani
chp2 - data link layer.pptxchp2 - data link layer.pptx
chp2 - data link layer.pptx
Chakra Pani15 views
Introduction to data link layer von Shashank HP
Introduction to data link layerIntroduction to data link layer
Introduction to data link layer
Shashank HP96 views
Jaimin chp-3 - data-link layer- 2011 batch von Jaimin Jani
Jaimin   chp-3 - data-link layer- 2011 batchJaimin   chp-3 - data-link layer- 2011 batch
Jaimin chp-3 - data-link layer- 2011 batch
Jaimin Jani3.6K views
Different protocols for data communication networks von Nt Arvind
Different protocols for data communication networks Different protocols for data communication networks
Different protocols for data communication networks
Nt Arvind412 views
Chapter 2.1.1.pptx von botAlert
Chapter 2.1.1.pptxChapter 2.1.1.pptx
Chapter 2.1.1.pptx
botAlert3 views
Unit 2 data link control von Vishal kakade
Unit 2 data link controlUnit 2 data link control
Unit 2 data link control
Vishal kakade9.9K views
datalinklayermukesh-150130061041-conversion-gate01.pptx von lathass5
datalinklayermukesh-150130061041-conversion-gate01.pptxdatalinklayermukesh-150130061041-conversion-gate01.pptx
datalinklayermukesh-150130061041-conversion-gate01.pptx
lathass58 views
Error detection methods-computer networks von DHIVYADEVAKI
Error detection methods-computer networksError detection methods-computer networks
Error detection methods-computer networks
DHIVYADEVAKI340 views

Último

Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation) von
 Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation) Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation)
Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation)AnshulDewangan3
275 views12 Folien
Classification of crude drugs.pptx von
Classification of crude drugs.pptxClassification of crude drugs.pptx
Classification of crude drugs.pptxGayatriPatra14
65 views13 Folien
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptx von
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptxOEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptx
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptxInge de Waard
165 views29 Folien
Class 10 English notes 23-24.pptx von
Class 10 English notes 23-24.pptxClass 10 English notes 23-24.pptx
Class 10 English notes 23-24.pptxTARIQ KHAN
95 views53 Folien
SIMPLE PRESENT TENSE_new.pptx von
SIMPLE PRESENT TENSE_new.pptxSIMPLE PRESENT TENSE_new.pptx
SIMPLE PRESENT TENSE_new.pptxnisrinamadani2
173 views15 Folien
11.28.23 Social Capital and Social Exclusion.pptx von
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptxmary850239
112 views25 Folien

Último(20)

Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation) von AnshulDewangan3
 Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation) Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation)
Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation)
AnshulDewangan3275 views
Classification of crude drugs.pptx von GayatriPatra14
Classification of crude drugs.pptxClassification of crude drugs.pptx
Classification of crude drugs.pptx
GayatriPatra1465 views
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptx von Inge de Waard
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptxOEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptx
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptx
Inge de Waard165 views
Class 10 English notes 23-24.pptx von TARIQ KHAN
Class 10 English notes 23-24.pptxClass 10 English notes 23-24.pptx
Class 10 English notes 23-24.pptx
TARIQ KHAN95 views
11.28.23 Social Capital and Social Exclusion.pptx von mary850239
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptx
mary850239112 views
Chemistry of sex hormones.pptx von RAJ K. MAURYA
Chemistry of sex hormones.pptxChemistry of sex hormones.pptx
Chemistry of sex hormones.pptx
RAJ K. MAURYA119 views
Plastic waste.pdf von alqaseedae
Plastic waste.pdfPlastic waste.pdf
Plastic waste.pdf
alqaseedae110 views
Scope of Biochemistry.pptx von shoba shoba
Scope of Biochemistry.pptxScope of Biochemistry.pptx
Scope of Biochemistry.pptx
shoba shoba121 views
Use of Probiotics in Aquaculture.pptx von AKSHAY MANDAL
Use of Probiotics in Aquaculture.pptxUse of Probiotics in Aquaculture.pptx
Use of Probiotics in Aquaculture.pptx
AKSHAY MANDAL81 views
AI Tools for Business and Startups von Svetlin Nakov
AI Tools for Business and StartupsAI Tools for Business and Startups
AI Tools for Business and Startups
Svetlin Nakov89 views
Class 10 English lesson plans von TARIQ KHAN
Class 10 English  lesson plansClass 10 English  lesson plans
Class 10 English lesson plans
TARIQ KHAN239 views
Education and Diversity.pptx von DrHafizKosar
Education and Diversity.pptxEducation and Diversity.pptx
Education and Diversity.pptx
DrHafizKosar107 views

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.