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 of 52

Recommended

MEDIUM-ACCESS CONTROL SUB LAYER.ppt by
MEDIUM-ACCESS CONTROL SUB LAYER.pptMEDIUM-ACCESS CONTROL SUB LAYER.ppt
MEDIUM-ACCESS CONTROL SUB LAYER.pptDrTThendralCompSci
157 views33 slides
NETWORK LAYER.ppt by
NETWORK LAYER.pptNETWORK LAYER.ppt
NETWORK LAYER.pptDrTThendralCompSci
191 views35 slides
PHYSICAL LAYER.ppt by
PHYSICAL LAYER.pptPHYSICAL LAYER.ppt
PHYSICAL LAYER.pptDrTThendralCompSci
310 views81 slides
COMPUTER NETWORK by
COMPUTER NETWORKCOMPUTER NETWORK
COMPUTER NETWORKDrTThendralCompSci
253 views39 slides
UNIT I.ppt by
UNIT I.pptUNIT I.ppt
UNIT I.pptDrTThendralCompSci
372 views115 slides
Lan technologies by
Lan technologiesLan technologies
Lan technologiesOnline
5K views14 slides

More Related Content

What's hot

AI PPT-ALR_Unit-3-1.pdf by
AI PPT-ALR_Unit-3-1.pdfAI PPT-ALR_Unit-3-1.pdf
AI PPT-ALR_Unit-3-1.pdflokesh406075
180 views54 slides
csma ca by
 csma ca csma ca
csma caHaroon Khan
8.2K views28 slides
Flow & Error Control by
Flow & Error ControlFlow & Error Control
Flow & Error Controltameemyousaf
38.3K views36 slides
Bridge by
BridgeBridge
BridgeMadhushree Ghosh
7.1K views22 slides
Networking devices by
Networking devicesNetworking devices
Networking devicesrupinderj
145.8K views20 slides
Ethernet,token ring by
Ethernet,token ring Ethernet,token ring
Ethernet,token ring Hareem Naz
1.4K views18 slides

What's hot(20)

AI PPT-ALR_Unit-3-1.pdf by lokesh406075
AI PPT-ALR_Unit-3-1.pdfAI PPT-ALR_Unit-3-1.pdf
AI PPT-ALR_Unit-3-1.pdf
lokesh406075180 views
Flow & Error Control by tameemyousaf
Flow & Error ControlFlow & Error Control
Flow & Error Control
tameemyousaf38.3K views
Networking devices by rupinderj
Networking devicesNetworking devices
Networking devices
rupinderj145.8K views
Ethernet,token ring by Hareem Naz
Ethernet,token ring Ethernet,token ring
Ethernet,token ring
Hareem Naz1.4K views
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol) by Kruti Niranjan
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)
Kruti Niranjan11.5K views
Flow control &amp; error control by ManishTadhiyal
Flow control &amp; error controlFlow control &amp; error control
Flow control &amp; error control
ManishTadhiyal1.1K views
Csma protocols by Manal Shah
Csma protocolsCsma protocols
Csma protocols
Manal Shah9.1K views
Circuit and packet_switching by hoanv
Circuit and packet_switchingCircuit and packet_switching
Circuit and packet_switching
hoanv12.4K views
CSMA /CD PPT ON SLIDESHARE by Khushboo Pal
CSMA /CD PPT ON SLIDESHARECSMA /CD PPT ON SLIDESHARE
CSMA /CD PPT ON SLIDESHARE
Khushboo Pal5.5K views
PPP (Point to Point Protocol) by Ali Jafar
PPP (Point to Point Protocol)PPP (Point to Point Protocol)
PPP (Point to Point Protocol)
Ali Jafar3K views
Transmission Medium by sabari Giri
Transmission MediumTransmission Medium
Transmission Medium
sabari Giri3.6K views
Networking Basics by Carlo Fonda
Networking BasicsNetworking Basics
Networking Basics
Carlo Fonda19.9K views
Routing algorithm by Bushra M
Routing algorithmRouting algorithm
Routing algorithm
Bushra M35.8K views

Similar to DATA-LINK LAYER.ppt

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

Similar to DATA-LINK LAYER.ppt(20)

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

More from DrTThendralCompSci

The Application Layer.ppt by
The Application Layer.pptThe Application Layer.ppt
The Application Layer.pptDrTThendralCompSci
101 views35 slides
Transport Layer.pptx by
Transport Layer.pptxTransport Layer.pptx
Transport Layer.pptxDrTThendralCompSci
78 views28 slides
SOFTWARE QUALITY ASSURANCE.ppt by
SOFTWARE QUALITY ASSURANCE.pptSOFTWARE QUALITY ASSURANCE.ppt
SOFTWARE QUALITY ASSURANCE.pptDrTThendralCompSci
256 views30 slides
Software Configuration Management.ppt by
Software Configuration Management.pptSoftware Configuration Management.ppt
Software Configuration Management.pptDrTThendralCompSci
12 views23 slides
UNIT TESTING.pptx by
UNIT TESTING.pptxUNIT TESTING.pptx
UNIT TESTING.pptxDrTThendralCompSci
115 views21 slides
SOFTWARE TESTING.pptx by
SOFTWARE TESTING.pptxSOFTWARE TESTING.pptx
SOFTWARE TESTING.pptxDrTThendralCompSci
366 views48 slides

More from DrTThendralCompSci(16)

Software design and Software engineering.pptx by DrTThendralCompSci
Software design and Software engineering.pptxSoftware design and Software engineering.pptx
Software design and Software engineering.pptx
DrTThendralCompSci108 views
Software design and Software engineering.pptx by DrTThendralCompSci
Software design and Software engineering.pptxSoftware design and Software engineering.pptx
Software design and Software engineering.pptx
DrTThendralCompSci267 views
Unit 1 - Introduction to Software Engineering.ppt by DrTThendralCompSci
Unit 1 - Introduction to Software Engineering.pptUnit 1 - Introduction to Software Engineering.ppt
Unit 1 - Introduction to Software Engineering.ppt
DrTThendralCompSci220 views
Unit 1 - Introduction to Software Engineering.ppt by DrTThendralCompSci
Unit 1 - Introduction to Software Engineering.pptUnit 1 - Introduction to Software Engineering.ppt
Unit 1 - Introduction to Software Engineering.ppt
DrTThendralCompSci288 views

Recently uploaded

Retail Store Scavenger Hunt.pptx by
Retail Store Scavenger Hunt.pptxRetail Store Scavenger Hunt.pptx
Retail Store Scavenger Hunt.pptxjmurphy154
53 views10 slides
Thanksgiving!.pdf by
Thanksgiving!.pdfThanksgiving!.pdf
Thanksgiving!.pdfEnglishCEIPdeSigeiro
568 views17 slides
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx by
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptxGuidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptxNiranjan Chavan
42 views48 slides
unidad 3.pdf by
unidad 3.pdfunidad 3.pdf
unidad 3.pdfMarcosRodriguezUcedo
138 views38 slides
Six Sigma Concept by Sahil Srivastava.pptx by
Six Sigma Concept by Sahil Srivastava.pptxSix Sigma Concept by Sahil Srivastava.pptx
Six Sigma Concept by Sahil Srivastava.pptxSahil Srivastava
51 views11 slides
The Future of Micro-credentials: Is Small Really Beautiful? by
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 Brown
102 views35 slides

Recently uploaded(20)

Retail Store Scavenger Hunt.pptx by jmurphy154
Retail Store Scavenger Hunt.pptxRetail Store Scavenger Hunt.pptx
Retail Store Scavenger Hunt.pptx
jmurphy15453 views
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx by Niranjan Chavan
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptxGuidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Niranjan Chavan42 views
Six Sigma Concept by Sahil Srivastava.pptx by Sahil Srivastava
Six Sigma Concept by Sahil Srivastava.pptxSix Sigma Concept by Sahil Srivastava.pptx
Six Sigma Concept by Sahil Srivastava.pptx
Sahil Srivastava51 views
The Future of Micro-credentials: Is Small Really Beautiful? by 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 Brown102 views
Introduction to AERO Supply Chain - #BEAERO Trainning program by 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 Wajih123 views
JQUERY.pdf by ArthyR3
JQUERY.pdfJQUERY.pdf
JQUERY.pdf
ArthyR3107 views
Pharmaceutical Analysis PPT (BP 102T) by yakshpharmacy009
Pharmaceutical Analysis PPT (BP 102T) Pharmaceutical Analysis PPT (BP 102T)
Pharmaceutical Analysis PPT (BP 102T)
yakshpharmacy009116 views
Ask The Expert! Nonprofit Website Tools, Tips, and Technology.pdf by TechSoup
 Ask The Expert! Nonprofit Website Tools, Tips, and Technology.pdf Ask The Expert! Nonprofit Website Tools, Tips, and Technology.pdf
Ask The Expert! Nonprofit Website Tools, Tips, and Technology.pdf
TechSoup 62 views
Payment Integration using Braintree Connector | MuleSoft Mysore Meetup #37 by MysoreMuleSoftMeetup
Payment Integration using Braintree Connector | MuleSoft Mysore Meetup #37Payment Integration using Braintree Connector | MuleSoft Mysore Meetup #37
Payment Integration using Braintree Connector | MuleSoft Mysore Meetup #37
Education of marginalized and socially disadvantages segments.pptx by GarimaBhati5
Education of marginalized and socially disadvantages segments.pptxEducation of marginalized and socially disadvantages segments.pptx
Education of marginalized and socially disadvantages segments.pptx
GarimaBhati547 views
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE... by Nguyen Thanh Tu Collection
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...
Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv... by Taste
Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv...Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv...
Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv...
Taste62 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