DATA-LINK LAYER.ppt

The Data Link Layer
Dr.T.Thendral, Assistant Professor,
SRCW
OBJECTIVE
• Data Link Layer Design Issues
• Error Detection and Correction
• Elementary Data Link Protocols
• Sliding Window Protocols
Dr.T.Thendral, Assistant Professor,
SRCW
Data Link Layer Design Issues
Dr.T.Thendral, Assistant Professor,
SRCW
Functions of the Data Link Layer
• Provide service interface to the network layer
• Dealing with transmission errors
• Regulating data flow
• Slow receivers not swamped by fast senders
Dr.T.Thendral, Assistant Professor,
SRCW
Functions of the Data Link Layer
Relationship between packets and frames.
Dr.T.Thendral, Assistant Professor,
SRCW
Services Provided to Network Layer
(a) Virtual Communication
(b) Actual Communication
Reference
Dr.T.Thendral, Assistant Professor,
SRCW
The data link layer can be designed to
offer various services
Three reasonable possibilities are
 Unacknowledged connectionless service
 Acknowledged connectionless service
 Acknowledged connection-oriented
service
Dr.T.Thendral, Assistant Professor,
SRCW
The routing code frequently wants the
job done right with reliable service
It does not want to be bothered too
often with packets that got lost on the
way
 Data link protocol, shown in the dotted
rectangle, to make unreliable
communication lines look perfect or, at
least, fairly good
Dr.T.Thendral, Assistant Professor,
SRCW
Services Provided to Network Layer
Reference
Dr.T.Thendral, Assistant Professor,
SRCW
Framing
 To provide service to the network layer, the data link layer must
use the service provided to it by the physical layer
 The number of bits received may be less than, equal to, or more
than 140 the number of bits transmitted, and they may have
different values.
 It is up to the data link layer to detect and, if necessary, correct
errors
 Since it is too risky to count on timing to mark the start and end of
each frame
 Four Methods:
 1. Character count
 2. Flag bytes with byte stuffing
 3. Starting and ending flags, with bit stuffing
 4. Physical layer coding violations
Dr.T.Thendral, Assistant Professor,
SRCW
Framing
A character stream. (a) Without errors. (b) With one error.
Character count
Dr.T.Thendral, Assistant Professor,
SRCW
• The second framing method gets around the problem of
resynchronization after an error by having each frame start
and end with special bytes
• Recent years most protocols have used the same byte,
called a flag byte, as both the starting and ending delimiter,
as FLAG.
• If the receiver ever loses synchronization, it can just search
for the flag byte to find the end of the current frame
• Two consecutive flag bytes indicate the end of one frame and
start of the next one.
Flag bytes with byte stuffing
Dr.T.Thendral, Assistant Professor,
SRCW
Framing
(a) A frame delimited by flag bytes.
(b) Four examples of byte sequences before and after stuffing.
ESCAPE BYTE (ESC)
Flag bytes with BYTE stuffing
Dr.T.Thendral, Assistant Professor,
SRCW
a) Each frame begins and ends with a special bit pattern, 01111110 (in
fact, a flag byte).
b) Whenever the sender's data link layer encounters five consecutive
1s in the data, it automatically stuffs a 0 bit into the outgoing bit
stream
Starting and ending flags, with BIT stuffing
Dr.T.Thendral, Assistant Professor,
SRCW
Framing
Bit stuffing
(a) The original data.
(b) The data as they appear on the line.
(c) The data as they are stored in receiver’s memory after destuffing.
Dr.T.Thendral, Assistant Professor,
SRCW
Error Detection and Correction
Error-Detecting Codes
•Parity bit
•Checksum
• https://www.youtube.com/watch?v=dbGJcinMJKM&t=0s
•Cyclic Redundancy Check Codes – CRC codes
• https://www.youtube.com/watch?v=PzNLmP5q8Ag
Error-Correcting Codes
•Hamming code
• https://www.youtube.com/watch?v=UNe3tF00gFQ
Dr.T.Thendral, Assistant Professor,
SRCW
Hamming Distance
• Some codes words are valid; others are invalid
• Hamming distance between two code words is number of bits
that must be flipped to change from one to the other
• If Hamming distance is d then d single bit errors needed to change one
word to the other
• Hamming distance of a code is the minimum Hamming
distance between two valid code words
• Detecting one single-bit error requires a distance 2 code; how
does this generalize?
• Correcting one single-bit error requires a distance 3 code; how
does this generalize?
Dr.T.Thendral, Assistant Professor,
SRCW
Parity Schemes
• Parity bits: choose a rule
• Even parity – each codeword has even number of 1’s
• Odd parity – each codeword has odd number of 1’s
• Always transmit according to the rule
• On receipt, if rule is violated, word is invalid
• Can also do “vertical parity” over whole block to achieve
single-bit error correction
Dr.T.Thendral, Assistant Professor,
SRCW
CRC Schemes
• CRC – Cyclic Redundancy Check or polynomial code
• Consider bits of a message to be coefficients of a polynomial
M(x)
• 1011 – 1x3 + 0x2 + 1x1 + 1x0
• Of course real messages will be much longer and hence of higher degree
• Agree on a small-degree generator polynomial G(x) of degree r
• Note: G(x) has r digits to the right of the leading 1, hence r+1 total
• Divide xrM(x) by G(x) using modulo 2 division (no carries or
borrows) getting the remainder polynomial R(x)
• Transmit T(x) = xrM(x) - R(x); note that this has remainder 0
when divided by G(x)
• Receiver rejects frame if the remainder it computers is not 0
Dr.T.Thendral, Assistant Professor,
SRCW
Error-Detecting Codes
Calculation of the polynomial code checksum.
Dr.T.Thendral, Assistant Professor,
SRCW
CRC Properties
• Easily computed with feedback shift register hardware
• Detects any single-bit error
• Proper choice of G(x) gives detection of any two bit errors
• Proper choice of G(x) gives detection of any odd number of bit
errors
• Detects any burst error of length <= r; Why?
• Received message is T(x)+E(x) for some error polynomial E(x)
• If E(x) represents a burst of length <= r then it can be written as xi(F(x))
where the degree of F(x) is < r
• If G(x) has an x0 term it can’t divide xi and no degree r polynomial
divides a polynomial of degree < r
Dr.T.Thendral, Assistant Professor,
SRCW
Elementary Data-link Protocols
a) https://www.youtube.com/watch?v=v5zT-tp9P_I
b) Elementary Data Link Protocols
c) Physical layer, data link layer, and network layer are independent
processes that communicate by passing messages back and forth
d) In many cases, the physical and data link layer processes will be
running on a processor inside a special network I/O chip and the
network layer code will be running on the main CPU
Dr.T.Thendral, Assistant Professor,
SRCW
a) The data link layer has a number of specific functions it can carry
out. These functions include
b) 1. Providing a well-defined service interface to the network layer.
c) 2. Dealing with transmission errors.
d) 3. Regulating the flow of data so that slow receivers are not
swamped by fast senders.
Dr.T.Thendral, Assistant Professor,
SRCW
Elementary Data Link Protocols
• An Unrestricted Simplex Protocol
• No buffer limits, no errors
• A Simplex Stop-and-Wait Protocol
• Add buffer limits
• A Simplex Protocol for a Noisy Channel
• Add channel errors
Dr.T.Thendral, Assistant Professor,
SRCW
Protocol Definitions
Continued 
Some definitions needed in the protocols to follow.
These are located in the file protocol.h.
Five data structures are defined there: boolean,
seq_nr, packet, frame_kind, and frame
Dr.T.Thendral, Assistant Professor,
SRCW
Protocol
Definitions
(ctd.)
Some definitions
needed in the
protocols to follow.
These are located in
the file protocol.h.
Dr.T.Thendral, Assistant Professor,
SRCW
• A frame is composed of four fields: kind, seq, ack, and info, the first
three of which contain control information and the last of which
may contain actual data to be transferred.
Dr.T.Thendral, Assistant Professor,
SRCW
An Unrestricted Simplex Protocol
• As an initial example we will consider a protocol that is as simple as
it can be.
• Data are transmitted in one direction only.
• Both the transmitting and receiving network layers are always
ready.
• Processing time can be ignored. Infinite buffer space is available.
• And best of all, the communication channel between the data link
layers never damages or loses frames.
• No sequence numbers or acknowledgements are used here, so
MAX_SEQ is not needed.
• The only event type possible is frame_arrival (i.e., the arrival of an
undamaged frame)
Dr.T.Thendral, Assistant Professor,
SRCW
Unrestricted
Simplex
Protocol
Dr.T.Thendral, Assistant Professor,
SRCW
A Simplex Stop-and-Wait Protocol
• The communication channel is still assumed to be error free
however, and the data traffic is still simplex.
• The main problem we have to deal with here is how to prevent the
sender from flooding the receiver with data faster than the latter is
able to process them
• Protocols in which the sender sends one frame and then waits for an
acknowledgement before proceeding are called stop-and-wait
• The only difference between receiver1 and receiver2 is that after
delivering a packet to the network layer, receiver2 sends an
acknowledgement frame back to the sender before entering the wait
loop again.
Dr.T.Thendral, Assistant Professor,
SRCW
Simplex
Stop-and-
Wait
Protocol
Dr.T.Thendral, Assistant Professor,
SRCW
A Simplex Protocol for a Noisy
Channel
• Now let us consider the normal situation of a communication
channel that makes errors.
• Frames may be either damaged or lost completely.
• Consider the following scenario:
• 1. In network layer packet is correctly received at B and passed to
the network layer on B
• B sends an acknowledgement frame back to A.
• 2. The acknowledgement frame gets lost completely.
• 3. The data link layer on A eventually times out. Not having
received an acknowledgement, it (incorrectly) assumes that its data
frame was lost or damaged and sends the frame containing packet 1
again.
• 4. The duplicate frame also arrives at the data link layer on B. In
other words, the protocol will fail.
Dr.T.Thendral, Assistant Professor,
SRCW
A Simplex Protocol for a Noisy Channel
A positive acknowledgement with retransmission protocol.
Continued 
Dr.T.Thendral, Assistant Professor,
SRCW
A Simplex Protocol for a Noisy Channel (ctd.)
A positive acknowledgement with retransmission protocol.
Dr.T.Thendral, Assistant Professor,
SRCW
Sliding Window Protocols
• In the previous protocols, data frames were transmitted in one
direction only. In most practical situations, there is a need for
transmitting data in both directions
• One way of achieving full-duplex data transmission is to have two
separate communication channels and use each one for simplex data
traffic
Dr.T.Thendral, Assistant Professor,
SRCW
Sliding Window Protocols
• Why?
• Efficiency – bandwidth*delay product
• Efficiency – when errors occur
• A One-Bit Sliding Window Protocol
• A Protocol Using Go Back N
• A Protocol Using Selective Repeat
Dr.T.Thendral, Assistant Professor,
SRCW
Sliding Window Protocols
A sliding window of size 1, with a 3-bit sequence number
• Initially
• After the first frame has been sent
• After the first frame has been received
• After the first acknowledgement has been received
Dr.T.Thendral, Assistant Professor,
SRCW
A One-Bit Sliding Window Protocol
Continued 
Dr.T.Thendral, Assistant Professor,
SRCW
A One-Bit Sliding Window Protocol (ctd.)
Dr.T.Thendral, Assistant Professor,
SRCW
A One-Bit Sliding Window Protocol (2)
Two scenarios for protocol 4. (a) Normal case. (b) Abnormal
case. The notation is (seq, ack, packet number). An asterisk
indicates where a network layer accepts a packet.
Dr.T.Thendral, Assistant Professor,
SRCW
A Protocol Using Go Back N
Pipelining and error recovery. Effect on an error when
(a) Receiver’s window size is 1.
(b) Receiver’s window size is large.
Dr.T.Thendral, Assistant Professor,
SRCW
• Frames 0 and 1 are correctly received and acknowledged.
• Frame 2, however, is damaged or lost.
• The sender, unaware of this problem, continues to send frames until
the timer for frame 2 expires.
• Then it backs up to frame 2 and starts all over with it, sending 2, 3,
4, etc. all over again.
Dr.T.Thendral, Assistant Professor,
SRCW
Sliding
Window
Protocol
Using Go
Back N
Continued 
Dr.T.Thendral, Assistant Professor,
SRCW
Sliding Window Protocol Using Go Back N
Continued 
Dr.T.Thendral, Assistant Professor,
SRCW
Sliding Window Protocol Using Go Back N
Continued 
Dr.T.Thendral, Assistant Professor,
SRCW
Sliding Window Protocol Using Go Back N
Dr.T.Thendral, Assistant Professor,
SRCW
Sliding Window Protocol Using Go Back N (2)
Simulation of multiple timers in software.
Dr.T.Thendral, Assistant Professor,
SRCW
A Sliding Window Protocol Using Selective Repeat
Continued 
Dr.T.Thendral, Assistant Professor,
SRCW
Continued 
A Sliding Window Protocol Using Selective Repeat (2)
Dr.T.Thendral, Assistant Professor,
SRCW
A Sliding Window Protocol Using Selective Repeat (3)
Continued 
Dr.T.Thendral, Assistant Professor,
SRCW
A Sliding Window Protocol Using Selective Repeat (4)
Dr.T.Thendral, Assistant Professor,
SRCW
A Sliding Window Protocol Using Selective Repeat (5)
(a) Initial situation with a window size seven.
(b) After seven frames sent and received, but not acknowledged.
(c) Initial situation with a window size of four.
(d) After four frames sent and received, but not acknowledged.
Dr.T.Thendral, Assistant Professor,
SRCW
1 von 52

Recomendados

MEDIUM-ACCESS CONTROL SUB LAYER.ppt von
MEDIUM-ACCESS CONTROL SUB LAYER.pptMEDIUM-ACCESS CONTROL SUB LAYER.ppt
MEDIUM-ACCESS CONTROL SUB LAYER.pptDrTThendralCompSci
160 views33 Folien
NETWORK LAYER.ppt von
NETWORK LAYER.pptNETWORK LAYER.ppt
NETWORK LAYER.pptDrTThendralCompSci
191 views35 Folien
PHYSICAL LAYER.ppt von
PHYSICAL LAYER.pptPHYSICAL LAYER.ppt
PHYSICAL LAYER.pptDrTThendralCompSci
312 views81 Folien
COMPUTER NETWORK von
COMPUTER NETWORKCOMPUTER NETWORK
COMPUTER NETWORKDrTThendralCompSci
256 views39 Folien
UNIT I.ppt von
UNIT I.pptUNIT I.ppt
UNIT I.pptDrTThendralCompSci
380 views115 Folien
2.6 ethernet ieee 802.3 von
2.6 ethernet   ieee 802.32.6 ethernet   ieee 802.3
2.6 ethernet ieee 802.3JAIGANESH SEKAR
852 views16 Folien

Más contenido relacionado

Was ist angesagt?

X.25 von
X.25X.25
X.25Ali Usman
13.7K views29 Folien
Introduction to Data-Link Layer von
Introduction to Data-Link LayerIntroduction to Data-Link Layer
Introduction to Data-Link LayerAbdullaziz Tagawy
2.8K views15 Folien
Ethernet and Token ring (Computer Networks) von
Ethernet and Token ring (Computer Networks)Ethernet and Token ring (Computer Networks)
Ethernet and Token ring (Computer Networks)Shail Nakum
1.1K views16 Folien
Introduction to the Data Link Layer von
Introduction to the Data Link LayerIntroduction to the Data Link Layer
Introduction to the Data Link LayerMeenakshi Paul
572 views27 Folien
IEEE standards 802.3.&802.11 von
IEEE standards 802.3.&802.11IEEE standards 802.3.&802.11
IEEE standards 802.3.&802.11Keshav Maheshwari
3.1K views43 Folien
Data link layer von
Data link layerData link layer
Data link layerAbdul MaTéèñ
297 views24 Folien

Was ist angesagt?(20)

X.25 von Ali Usman
X.25X.25
X.25
Ali Usman13.7K views
Ethernet and Token ring (Computer Networks) von Shail Nakum
Ethernet and Token ring (Computer Networks)Ethernet and Token ring (Computer Networks)
Ethernet and Token ring (Computer Networks)
Shail Nakum1.1K views
Introduction to the Data Link Layer von Meenakshi Paul
Introduction to the Data Link LayerIntroduction to the Data Link Layer
Introduction to the Data Link Layer
Meenakshi Paul572 views
Media Access Control von HusnainHadi
Media Access ControlMedia Access Control
Media Access Control
HusnainHadi232 views
Dcn ppt on data link layer von roma bora
Dcn ppt on data link layerDcn ppt on data link layer
Dcn ppt on data link layer
roma bora1.9K views
Csma(carriers sense-multiple-acess) von Rajan Kandel
Csma(carriers sense-multiple-acess) Csma(carriers sense-multiple-acess)
Csma(carriers sense-multiple-acess)
Rajan Kandel4.2K views
Congestion control von Aman Jaiswal
Congestion controlCongestion control
Congestion control
Aman Jaiswal35.6K views
Multiple access control protocol von meenamunesh
Multiple access control protocol Multiple access control protocol
Multiple access control protocol
meenamunesh50.3K views

Similar a DATA-LINK LAYER.ppt

Ethernet.ppt von
Ethernet.pptEthernet.ppt
Ethernet.pptDrTThendralCompSci
97 views30 Folien
DLL PPT.ppt von
DLL PPT.pptDLL PPT.ppt
DLL PPT.pptSmtPArunaKumari
2 views49 Folien
Ch3.ppt von
Ch3.pptCh3.ppt
Ch3.pptThirft
30 views49 Folien
Chapter 2.1.1.pptx von
Chapter 2.1.1.pptxChapter 2.1.1.pptx
Chapter 2.1.1.pptxbotAlert
3 views62 Folien
B21DA0201_02.ppt von
B21DA0201_02.pptB21DA0201_02.ppt
B21DA0201_02.pptDrPreethiD1
2 views157 Folien
Error detection and correction von
Error detection and correctionError detection and correction
Error detection and correctionAbdul Razaq
133 views20 Folien

Similar a DATA-LINK LAYER.ppt(20)

Ch3.ppt von Thirft
Ch3.pptCh3.ppt
Ch3.ppt
Thirft30 views
Chapter 2.1.1.pptx von botAlert
Chapter 2.1.1.pptxChapter 2.1.1.pptx
Chapter 2.1.1.pptx
botAlert3 views
Error detection and correction von Abdul Razaq
Error detection and correctionError detection and correction
Error detection and correction
Abdul Razaq133 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
Osi model von maha tce
Osi model Osi model
Osi model
maha tce1.1K views
Introduction to data link layer von Shashank HP
Introduction to data link layerIntroduction to data link layer
Introduction to data link layer
Shashank HP97 views
Computer network coe351- part4- final von Taymoor Nazmy
Computer network coe351- part4- finalComputer network coe351- part4- final
Computer network coe351- part4- final
Taymoor Nazmy16 views
Data Communication & Computer Networks von Sreedhar Chowdam
Data Communication & Computer NetworksData Communication & Computer Networks
Data Communication & Computer Networks
Sreedhar Chowdam295 views
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

Más de DrTThendralCompSci

The Application Layer.ppt von
The Application Layer.pptThe Application Layer.ppt
The Application Layer.pptDrTThendralCompSci
104 views35 Folien
Transport Layer.pptx von
Transport Layer.pptxTransport Layer.pptx
Transport Layer.pptxDrTThendralCompSci
80 views28 Folien
SOFTWARE QUALITY ASSURANCE.ppt von
SOFTWARE QUALITY ASSURANCE.pptSOFTWARE QUALITY ASSURANCE.ppt
SOFTWARE QUALITY ASSURANCE.pptDrTThendralCompSci
268 views30 Folien
Software Configuration Management.ppt von
Software Configuration Management.pptSoftware Configuration Management.ppt
Software Configuration Management.pptDrTThendralCompSci
12 views23 Folien
UNIT TESTING.pptx von
UNIT TESTING.pptxUNIT TESTING.pptx
UNIT TESTING.pptxDrTThendralCompSci
124 views21 Folien
SOFTWARE TESTING.pptx von
SOFTWARE TESTING.pptxSOFTWARE TESTING.pptx
SOFTWARE TESTING.pptxDrTThendralCompSci
379 views48 Folien

Más de DrTThendralCompSci(16)

Unit 1 - Introduction to Software Engineering.ppt von DrTThendralCompSci
Unit 1 - Introduction to Software Engineering.pptUnit 1 - Introduction to Software Engineering.ppt
Unit 1 - Introduction to Software Engineering.ppt
DrTThendralCompSci224 views
Unit 1 - Introduction to Software Engineering.ppt von DrTThendralCompSci
Unit 1 - Introduction to Software Engineering.pptUnit 1 - Introduction to Software Engineering.ppt
Unit 1 - Introduction to Software Engineering.ppt
DrTThendralCompSci318 views

Último

Meet the Bible von
Meet the BibleMeet the Bible
Meet the BibleSteve Thomason
83 views80 Folien
Volf work.pdf von
Volf work.pdfVolf work.pdf
Volf work.pdfMariaKenney3
91 views43 Folien
DISTILLATION.pptx von
DISTILLATION.pptxDISTILLATION.pptx
DISTILLATION.pptxAnupkumar Sharma
82 views47 Folien
12.5.23 Poverty and Precarity.pptx von
12.5.23 Poverty and Precarity.pptx12.5.23 Poverty and Precarity.pptx
12.5.23 Poverty and Precarity.pptxmary850239
559 views30 Folien
Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab... von
Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...
Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...RAHUL PAL
45 views26 Folien
Berry country.pdf von
Berry country.pdfBerry country.pdf
Berry country.pdfMariaKenney3
82 views12 Folien

Último(20)

12.5.23 Poverty and Precarity.pptx von mary850239
12.5.23 Poverty and Precarity.pptx12.5.23 Poverty and Precarity.pptx
12.5.23 Poverty and Precarity.pptx
mary850239559 views
Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab... von RAHUL PAL
Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...
Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...
RAHUL PAL45 views
Education of marginalized and socially disadvantages segments.pptx von GarimaBhati5
Education of marginalized and socially disadvantages segments.pptxEducation of marginalized and socially disadvantages segments.pptx
Education of marginalized and socially disadvantages segments.pptx
GarimaBhati552 views
The Future of Micro-credentials: Is Small Really Beautiful? von Mark Brown
The Future of Micro-credentials:  Is Small Really Beautiful?The Future of Micro-credentials:  Is Small Really Beautiful?
The Future of Micro-credentials: Is Small Really Beautiful?
Mark Brown121 views
Introduction to AERO Supply Chain - #BEAERO Trainning program von Guennoun Wajih
Introduction to AERO Supply Chain  - #BEAERO Trainning programIntroduction to AERO Supply Chain  - #BEAERO Trainning program
Introduction to AERO Supply Chain - #BEAERO Trainning program
Guennoun Wajih135 views
11.21.23 Economic Precarity and Global Economic Forces.pptx von mary850239
11.21.23 Economic Precarity and Global Economic Forces.pptx11.21.23 Economic Precarity and Global Economic Forces.pptx
11.21.23 Economic Precarity and Global Economic Forces.pptx
mary85023994 views
Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption... von BC Chew
Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption...Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption...
Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption...
BC Chew40 views
GSoC 2024 .pdf von ShabNaz2
GSoC 2024 .pdfGSoC 2024 .pdf
GSoC 2024 .pdf
ShabNaz245 views
JRN 362 - Lecture Twenty-Three (Epilogue) von Rich Hanley
JRN 362 - Lecture Twenty-Three (Epilogue)JRN 362 - Lecture Twenty-Three (Epilogue)
JRN 362 - Lecture Twenty-Three (Epilogue)
Rich Hanley44 views

DATA-LINK LAYER.ppt

  • 1. The Data Link Layer Dr.T.Thendral, Assistant Professor, SRCW
  • 2. OBJECTIVE • Data Link Layer Design Issues • Error Detection and Correction • Elementary Data Link Protocols • Sliding Window Protocols Dr.T.Thendral, Assistant Professor, SRCW
  • 3. Data Link Layer Design Issues Dr.T.Thendral, Assistant Professor, SRCW
  • 4. Functions of the Data Link Layer • Provide service interface to the network layer • Dealing with transmission errors • Regulating data flow • Slow receivers not swamped by fast senders Dr.T.Thendral, Assistant Professor, SRCW
  • 5. Functions of the Data Link Layer Relationship between packets and frames. Dr.T.Thendral, Assistant Professor, SRCW
  • 6. Services Provided to Network Layer (a) Virtual Communication (b) Actual Communication Reference Dr.T.Thendral, Assistant Professor, SRCW
  • 7. The data link layer can be designed to offer various services Three reasonable possibilities are  Unacknowledged connectionless service  Acknowledged connectionless service  Acknowledged connection-oriented service Dr.T.Thendral, Assistant Professor, SRCW
  • 8. The routing code frequently wants the job done right with reliable service It does not want to be bothered too often with packets that got lost on the way  Data link protocol, shown in the dotted rectangle, to make unreliable communication lines look perfect or, at least, fairly good Dr.T.Thendral, Assistant Professor, SRCW
  • 9. Services Provided to Network Layer Reference Dr.T.Thendral, Assistant Professor, SRCW
  • 10. Framing  To provide service to the network layer, the data link layer must use the service provided to it by the physical layer  The number of bits received may be less than, equal to, or more than 140 the number of bits transmitted, and they may have different values.  It is up to the data link layer to detect and, if necessary, correct errors  Since it is too risky to count on timing to mark the start and end of each frame  Four Methods:  1. Character count  2. Flag bytes with byte stuffing  3. Starting and ending flags, with bit stuffing  4. Physical layer coding violations Dr.T.Thendral, Assistant Professor, SRCW
  • 11. Framing A character stream. (a) Without errors. (b) With one error. Character count Dr.T.Thendral, Assistant Professor, SRCW
  • 12. • The second framing method gets around the problem of resynchronization after an error by having each frame start and end with special bytes • Recent years most protocols have used the same byte, called a flag byte, as both the starting and ending delimiter, as FLAG. • If the receiver ever loses synchronization, it can just search for the flag byte to find the end of the current frame • Two consecutive flag bytes indicate the end of one frame and start of the next one. Flag bytes with byte stuffing Dr.T.Thendral, Assistant Professor, SRCW
  • 13. Framing (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing. ESCAPE BYTE (ESC) Flag bytes with BYTE stuffing Dr.T.Thendral, Assistant Professor, SRCW
  • 14. a) Each frame begins and ends with a special bit pattern, 01111110 (in fact, a flag byte). b) Whenever the sender's data link layer encounters five consecutive 1s in the data, it automatically stuffs a 0 bit into the outgoing bit stream Starting and ending flags, with BIT stuffing Dr.T.Thendral, Assistant Professor, SRCW
  • 15. Framing Bit stuffing (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in receiver’s memory after destuffing. Dr.T.Thendral, Assistant Professor, SRCW
  • 16. Error Detection and Correction Error-Detecting Codes •Parity bit •Checksum • https://www.youtube.com/watch?v=dbGJcinMJKM&t=0s •Cyclic Redundancy Check Codes – CRC codes • https://www.youtube.com/watch?v=PzNLmP5q8Ag Error-Correcting Codes •Hamming code • https://www.youtube.com/watch?v=UNe3tF00gFQ Dr.T.Thendral, Assistant Professor, SRCW
  • 17. Hamming Distance • Some codes words are valid; others are invalid • Hamming distance between two code words is number of bits that must be flipped to change from one to the other • If Hamming distance is d then d single bit errors needed to change one word to the other • Hamming distance of a code is the minimum Hamming distance between two valid code words • Detecting one single-bit error requires a distance 2 code; how does this generalize? • Correcting one single-bit error requires a distance 3 code; how does this generalize? Dr.T.Thendral, Assistant Professor, SRCW
  • 18. Parity Schemes • Parity bits: choose a rule • Even parity – each codeword has even number of 1’s • Odd parity – each codeword has odd number of 1’s • Always transmit according to the rule • On receipt, if rule is violated, word is invalid • Can also do “vertical parity” over whole block to achieve single-bit error correction Dr.T.Thendral, Assistant Professor, SRCW
  • 19. CRC Schemes • CRC – Cyclic Redundancy Check or polynomial code • Consider bits of a message to be coefficients of a polynomial M(x) • 1011 – 1x3 + 0x2 + 1x1 + 1x0 • Of course real messages will be much longer and hence of higher degree • Agree on a small-degree generator polynomial G(x) of degree r • Note: G(x) has r digits to the right of the leading 1, hence r+1 total • Divide xrM(x) by G(x) using modulo 2 division (no carries or borrows) getting the remainder polynomial R(x) • Transmit T(x) = xrM(x) - R(x); note that this has remainder 0 when divided by G(x) • Receiver rejects frame if the remainder it computers is not 0 Dr.T.Thendral, Assistant Professor, SRCW
  • 20. Error-Detecting Codes Calculation of the polynomial code checksum. Dr.T.Thendral, Assistant Professor, SRCW
  • 21. CRC Properties • Easily computed with feedback shift register hardware • Detects any single-bit error • Proper choice of G(x) gives detection of any two bit errors • Proper choice of G(x) gives detection of any odd number of bit errors • Detects any burst error of length <= r; Why? • Received message is T(x)+E(x) for some error polynomial E(x) • If E(x) represents a burst of length <= r then it can be written as xi(F(x)) where the degree of F(x) is < r • If G(x) has an x0 term it can’t divide xi and no degree r polynomial divides a polynomial of degree < r Dr.T.Thendral, Assistant Professor, SRCW
  • 22. Elementary Data-link Protocols a) https://www.youtube.com/watch?v=v5zT-tp9P_I b) Elementary Data Link Protocols c) Physical layer, data link layer, and network layer are independent processes that communicate by passing messages back and forth d) In many cases, the physical and data link layer processes will be running on a processor inside a special network I/O chip and the network layer code will be running on the main CPU Dr.T.Thendral, Assistant Professor, SRCW
  • 23. a) The data link layer has a number of specific functions it can carry out. These functions include b) 1. Providing a well-defined service interface to the network layer. c) 2. Dealing with transmission errors. d) 3. Regulating the flow of data so that slow receivers are not swamped by fast senders. Dr.T.Thendral, Assistant Professor, SRCW
  • 24. Elementary Data Link Protocols • An Unrestricted Simplex Protocol • No buffer limits, no errors • A Simplex Stop-and-Wait Protocol • Add buffer limits • A Simplex Protocol for a Noisy Channel • Add channel errors Dr.T.Thendral, Assistant Professor, SRCW
  • 25. Protocol Definitions Continued  Some definitions needed in the protocols to follow. These are located in the file protocol.h. Five data structures are defined there: boolean, seq_nr, packet, frame_kind, and frame Dr.T.Thendral, Assistant Professor, SRCW
  • 26. Protocol Definitions (ctd.) Some definitions needed in the protocols to follow. These are located in the file protocol.h. Dr.T.Thendral, Assistant Professor, SRCW
  • 27. • A frame is composed of four fields: kind, seq, ack, and info, the first three of which contain control information and the last of which may contain actual data to be transferred. Dr.T.Thendral, Assistant Professor, SRCW
  • 28. An Unrestricted Simplex Protocol • As an initial example we will consider a protocol that is as simple as it can be. • Data are transmitted in one direction only. • Both the transmitting and receiving network layers are always ready. • Processing time can be ignored. Infinite buffer space is available. • And best of all, the communication channel between the data link layers never damages or loses frames. • No sequence numbers or acknowledgements are used here, so MAX_SEQ is not needed. • The only event type possible is frame_arrival (i.e., the arrival of an undamaged frame) Dr.T.Thendral, Assistant Professor, SRCW
  • 30. A Simplex Stop-and-Wait Protocol • The communication channel is still assumed to be error free however, and the data traffic is still simplex. • The main problem we have to deal with here is how to prevent the sender from flooding the receiver with data faster than the latter is able to process them • Protocols in which the sender sends one frame and then waits for an acknowledgement before proceeding are called stop-and-wait • The only difference between receiver1 and receiver2 is that after delivering a packet to the network layer, receiver2 sends an acknowledgement frame back to the sender before entering the wait loop again. Dr.T.Thendral, Assistant Professor, SRCW
  • 32. A Simplex Protocol for a Noisy Channel • Now let us consider the normal situation of a communication channel that makes errors. • Frames may be either damaged or lost completely. • Consider the following scenario: • 1. In network layer packet is correctly received at B and passed to the network layer on B • B sends an acknowledgement frame back to A. • 2. The acknowledgement frame gets lost completely. • 3. The data link layer on A eventually times out. Not having received an acknowledgement, it (incorrectly) assumes that its data frame was lost or damaged and sends the frame containing packet 1 again. • 4. The duplicate frame also arrives at the data link layer on B. In other words, the protocol will fail. Dr.T.Thendral, Assistant Professor, SRCW
  • 33. A Simplex Protocol for a Noisy Channel A positive acknowledgement with retransmission protocol. Continued  Dr.T.Thendral, Assistant Professor, SRCW
  • 34. A Simplex Protocol for a Noisy Channel (ctd.) A positive acknowledgement with retransmission protocol. Dr.T.Thendral, Assistant Professor, SRCW
  • 35. Sliding Window Protocols • In the previous protocols, data frames were transmitted in one direction only. In most practical situations, there is a need for transmitting data in both directions • One way of achieving full-duplex data transmission is to have two separate communication channels and use each one for simplex data traffic Dr.T.Thendral, Assistant Professor, SRCW
  • 36. Sliding Window Protocols • Why? • Efficiency – bandwidth*delay product • Efficiency – when errors occur • A One-Bit Sliding Window Protocol • A Protocol Using Go Back N • A Protocol Using Selective Repeat Dr.T.Thendral, Assistant Professor, SRCW
  • 37. Sliding Window Protocols A sliding window of size 1, with a 3-bit sequence number • Initially • After the first frame has been sent • After the first frame has been received • After the first acknowledgement has been received Dr.T.Thendral, Assistant Professor, SRCW
  • 38. A One-Bit Sliding Window Protocol Continued  Dr.T.Thendral, Assistant Professor, SRCW
  • 39. A One-Bit Sliding Window Protocol (ctd.) Dr.T.Thendral, Assistant Professor, SRCW
  • 40. A One-Bit Sliding Window Protocol (2) Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case. The notation is (seq, ack, packet number). An asterisk indicates where a network layer accepts a packet. Dr.T.Thendral, Assistant Professor, SRCW
  • 41. A Protocol Using Go Back N Pipelining and error recovery. Effect on an error when (a) Receiver’s window size is 1. (b) Receiver’s window size is large. Dr.T.Thendral, Assistant Professor, SRCW
  • 42. • Frames 0 and 1 are correctly received and acknowledged. • Frame 2, however, is damaged or lost. • The sender, unaware of this problem, continues to send frames until the timer for frame 2 expires. • Then it backs up to frame 2 and starts all over with it, sending 2, 3, 4, etc. all over again. Dr.T.Thendral, Assistant Professor, SRCW
  • 43. Sliding Window Protocol Using Go Back N Continued  Dr.T.Thendral, Assistant Professor, SRCW
  • 44. Sliding Window Protocol Using Go Back N Continued  Dr.T.Thendral, Assistant Professor, SRCW
  • 45. Sliding Window Protocol Using Go Back N Continued  Dr.T.Thendral, Assistant Professor, SRCW
  • 46. Sliding Window Protocol Using Go Back N Dr.T.Thendral, Assistant Professor, SRCW
  • 47. Sliding Window Protocol Using Go Back N (2) Simulation of multiple timers in software. Dr.T.Thendral, Assistant Professor, SRCW
  • 48. A Sliding Window Protocol Using Selective Repeat Continued  Dr.T.Thendral, Assistant Professor, SRCW
  • 49. Continued  A Sliding Window Protocol Using Selective Repeat (2) Dr.T.Thendral, Assistant Professor, SRCW
  • 50. A Sliding Window Protocol Using Selective Repeat (3) Continued  Dr.T.Thendral, Assistant Professor, SRCW
  • 51. A Sliding Window Protocol Using Selective Repeat (4) Dr.T.Thendral, Assistant Professor, SRCW
  • 52. A Sliding Window Protocol Using Selective Repeat (5) (a) Initial situation with a window size seven. (b) After seven frames sent and received, but not acknowledged. (c) Initial situation with a window size of four. (d) After four frames sent and received, but not acknowledged. Dr.T.Thendral, Assistant Professor, SRCW