CEN 4500 Data Communications - PowerPoint PPT Presentation

About This Presentation
Title:

CEN 4500 Data Communications

Description:

CEN 4500 Data Communications Chapter 3: The Data Link Layer Instructor: S. Masoud Sadjadi http://www.cs.fiu.edu/~sadjadi/Teaching/ sadjadi At cs Dot fiu Dot edu – PowerPoint PPT presentation

Number of Views:76
Avg rating:3.0/5.0
Slides: 51
Provided by: usersCsF
Learn more at: http://users.cs.fiu.edu
Category:

less

Transcript and Presenter's Notes

Title: CEN 4500 Data Communications


1
CEN 4500 Data Communications
Chapter 3 The Data Link Layer
Instructor S. Masoud Sadjadi http//www.cs.fiu.ed
u/sadjadi/Teaching/ sadjadi At cs Dot fiu Dot
edu
2
Recap Data Link Layer
  • Data link layer is the second layer in the
    hierarchy of the hybrid reference model
  • Is to transform a raw transmission facility into
    a line that appears free of undetected
    transmission errors.

3
Recap Data Link Layer
  • We will study algorithms for achieving reliable,
    efficient communication between two adjacent
    machines at the data link layer.
  • Adjacent machines are two machines that are
    connected by a communication channel that acts
    conceptually like a wire (e.g., coaxial cable,
    telephone line, or point-to-point wireless
    channel)
  • A channel is called wire-like if the bits are
    delivered in exactly the same order in which they
    are sent.
  • What makes this layer essential is the fact that
  • communication channels make errors occasionally,
  • they have only a finite data rate, and
  • there is a non-zero propagation delay

4
Agenda
  • Design Issues
  • Error Detection and Correction
  • Elementary Data Link Protocols
  • Sliding Window Protocols
  • Protocol Verification
  • Example Data Link Protocols
  • Summary

5
Data Link Layer Design Issues
  • Functions of the Data Link Layer
  • Providing a well-defined service to the network
    layer
  • Dealing with transmission errors
  • Regulating the flow of data so that slow
    receivers are not swamped by fast senders
  • Solution
  • Data link layer takes the packets from the
    network layer and encapsulates them into frames
    for transmission.
  • A frame contains header, payload (packet), and
    trailer.
  • Frame management is what data link layer is all
    about.

6
Functions of the Data Link Layer
  • Relationship between packets and frames.

7
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.
8
Reasonable Service Possibilities
  • Unacknowledged connectionless service
  • When error-rate is very low, so that the recovery
    is left to the higher layers
  • Also for real-time traffic, such as voice
  • Most LANs use this on the data link layer
  • Acknowledged connectionless service
  • Useful over unreliable channels, such as wireless
  • Acknowledged connection-oriented service
  • Each frame is numbered to guarantee exactly once
    and in-order delivery of frames
  • A reliable bit stream

9
Services Provided to Network Layer
  • Placement of the data link protocol.

10
Framing
  • Physical layer accepts a raw bit stream and
    attempt to deliver it to the destination.
  • It is up to the data link layer to detect and, if
    necessary, correct errors.
  • The usual approach is for data link layer to
    break the bit stream up into discrete frames and
    compute the checksum for each frame.
  • Framing Methods
  • Character count count can be garbled
  • Flag bytes with byte stuffing starting and
    ending delimiters
  • Starting and ending flags, with bit stuffing
  • Physical layer coding violations

11
Framing Character Count
  • A character stream.
  • (a) Without errors.
  • (b) With one error.

12
Framing Flag Bytes w/ Byte Stuffing
  • What if the flag bytes bit pattern happens
    occurs in the date? Insert a escape byte (ESC)

(a) A frame delimited by flag bytes. (b) Four
examples of byte sequences before and after
stuffing.
13
Framing Bit Stuffing
  • Each frame starts and ends with a special bit
    pattern, 01111110 (in fact, a flag byte).
  • Whenever the senders data link layer encounters
    five consecutive 1s in the data, it automatically
    stuffs a 0 bit into the outgoing bit stream

Bit stuffing (a) The original data. (b) The data
as they appear on the line. (c) The data as they
are stored in receivers memory after destuffing.
14
Framing Physical Layer Coding Violation
  • This method is only applicable to networks in
    which the encoding on the physical medium
    contains some redundancy.
  • For example, some LANs encode 1 bit of data by
    using 2 physical bits
  • A 1 bit is a high-low pair
  • A 0 bit is a low-high pair
  • So, every data bit has a transition in the
    middle easy for the receiver to locate the bit
    boundaries.
  • High-high and low-low are not used for data!

15
Agenda
  • Design Issues
  • Error Detection and Correction
  • Elementary Data Link Protocols
  • Sliding Window Protocols
  • Protocol Verification
  • Example Data Link Protocols
  • Summary

16
Error Background
  • Transmission errors will be with us for a while
  • The local loops are still twisted copper pairs
  • Wireless communication is becoming more common
  • Error Property
  • As a result of the physical process that
    generates them, errors on some media (e.g.,
    radio) tend to come in bursts rather than singly.
  • A burst error does not imply that all the bits
    are wrong it just implies that at least the
    first and last are wrong
  • If errors were independent, most block would
    contain errors
  • However, they are much harder to correct than are
    isolated errors

17
Error Handling
  • Error Detection
  • On channels that are highly reliable, such as
    fiber, it is cheaper to detect errors and
    retransmit data
  • Error-detecting codes add enough redundant
    information to detect errors.
  • Error Correction
  • On channels such as wireless links that make many
    errors, retransmission does not make much sense
  • Error-correcting codes need to include enough
    redundant information not only to detect the
    error but also to correct it

18
Error-Detecting Codes CRC
  • Cyclic Redundancy Check (CRC)
  • Also known as polynomial code
  • Based on treating bit strings as representations
    of polynomials with coefficients of 0 and 1 only
  • A k-bit frame is regarded as the coefficient list
    for a polynomial with k terms, ranging from xk-1
    to x0.
  • For example, 110001 represents x5 x4 x0
  • Polynomial arithmetic is done modulo 2
  • There are no carries for addition or borrows for
    subtractions, both are identical to exclusive OR

19
CRC
  • The sender and receiver agree upon a generator
    polynomial, G(x), both of its high and low bits
    are 1
  • To compute the checksum for some frame with m
    bits, corresponding to the polynomial M(x), the
    frame must be longer than the generator
    polynomial
  • We append a checksum to the end of the frame,
    so that the resulting polynomial is dividable by
    G(x)

Calculation of the polynomial code checksum.
20
Error-Correcting Code Hamming Code
  • A frame consists of m data bits and r redundant,
    or check, bits.
  • n m r called n-bit codeword.
  • Hamming Distance
  • The number of bit positions in which two
    codewords differ
  • If two codewords are a Hamming distance d apart,
    it will require d single-bit errors to convert
    one into the other.
  • Given the algorithm to compute the check bits,
    that are 2m legal codewords out of 2n codewords
  • The Hamming distance of the complete code (the
    list of legal codewords) is the minimun distance
    of any two codewords in the list.

21
Error-Correcting Code Hamming Code
  • To detect d errors
  • you need a distance d 1 code
  • If you receive a frame with d error, it will have
    an illegal codeword
  • To correct d errors
  • you need a distance 2d 1 code
  • The closer legal codeword is the one to pick
  • Example, Parity Bit
  • The number of 1s are either even or odd
  • A code with single parity has distance 2

22
Error-Correcting Code Hamming Code
  • How many check bit do we need to be able to
    correct a 1 bit error?
  • For each 2m legal codewords, we need to have n
    illegal ones, so n 1 codewords should be
    reserved
  • 2m(n 1) lt 2n
  • OR
  • (m r 1) lt 2r

Hamming code to correct burst errors.
23
Agenda
  • Design Issues
  • Error Detection and Correction
  • Elementary Data Link Protocols
  • Sliding Window Protocols
  • Protocol Verification
  • Example Data Link Protocols
  • Summary

24
Elementary Data Link Protocols
  • An Unrestricted Simplex Protocol
  • Protocol 1
  • A Simplex Stop-and-Wait Protocol
  • Protocol 2
  • A Simplex Protocol for a Noisy Channel
  • Protocol 3
  • Try the simulator on your own and discuss it in
    your study group!

25
Assumptions for the Protocols
  • The physical, data link, and network layers are
    independent processes that communicate by passing
    messages back and forth.
  • Machine A is trying to send a long message to
    machine B, using a reliable, connection-oriented
    service.
  • Later, we will consider the case where B will try
    to send a message to A simultaneously.
  • A has an infinite supply of data ready to be sent
    to B.
  • In a realistic situation, the data link layer
    will not sit in a tight loop waiting for an
    event, but it will be implemented using
    interrupts
  • Machines do not crash
  • As far as the data link layer is concerned, the
    packet passed across the interface to data link
    is pure data.

26
Protocol Definitions
Continued ?
Some definitions needed in the protocols to
follow. These are located in the file protocol.h.
27
Protocol Definitions(ctd.)
Some definitions needed in the protocols to
follow. These are located in the file
protocol.h.
28
Unrestricted Simplex ProtocolProtocol 1
29
Simplex Stop-and-Wait ProtocolProtocol 2
30
A Simplex Protocol for a Noisy Channel Protocol 3
A positive acknowledgement with retransmission
protocol.
Continued ?
31
A Simplex Protocol for a Noisy Channel Protocol
3 (ctd.)
A positive acknowledgement with retransmission
protocol.
32
Agenda
  • Design Issues
  • Error Detection and Correction
  • Elementary Data Link Protocols
  • Sliding Window Protocols
  • Protocol Verification
  • Example Data Link Protocols
  • Summary

33
Sliding Window Protocols
  • Need for both way transmission of data
  • Using two simplex channels two expensive
  • Using one channel in both directions
    (intermixed), with temporarily delaying the ack
    (piggybacking)
  • A One-Bit Sliding Window Protocol
  • Protocol 4
  • A Protocol Using Go Back N
  • Protocol 5
  • A Protocol Using Selective Repeat
  • Protocol 6

34
Sliding Window Protocols (2)
  • On the sender side the frames that are sent or
    can be sent (no ack yet).
  • On the receiver side the frames that it may
    accept (discards other frames).
  • A sliding window of size 1, with a 3-bit sequence
    number.
  • (a) Initially.
  • (b) After the first frame has been sent.
  • (c) After the first frame has been received.
  • (d) After the first acknowledgement has been
    received.

35
A One-Bit Sliding Window Protocol Protocol 4
Continued ?
36
A One-Bit Sliding Window Protocol Protocol 4
(ctd.)
37
A One-Bit Sliding Window Protocol Protocol 4 (2)
  • Two scenarios for protocol 4. (a) Normal
    case. (b) Abnormal case, if both sides starts
    sending simultaneously (similar situation can
    occur as a result of premature timeouts). The
    notation is (seq, ack, packet number). An
    asterisk indicates where a network layer accepts
    a packet.

38
A Protocol Using Go Back N Protocol 5
  • Pipelining and error recovery. Effect on an
    error when
  • (a) Receivers window size is 1.
  • (b) Receivers window size is large.

39
Sliding Window Protocol Using Go Back N
Protocol 5
Continued ?
40
Sliding Window Protocol Using Go Back N Protocol
5
Continued ?
41
Sliding Window Protocol Using Go Back N Protocol
5
Continued ?
42
Sliding Window Protocol Using Go Back N
Protocol 5
43
Sliding Window Protocol Using Go Back N Protocol
5
  • Simulation of multiple timers in software.

44
A Sliding Window Protocol Using Selective Repeat
Protocol 6
Continued ?
45
A Sliding Window Protocol Using Selective Repeat
Protocol 6 (2)
Continued ?
46
A Sliding Window Protocol Using Selective Repeat
Protocol 6 (3)
Continued ?
47
A Sliding Window Protocol Using Selective Repeat
Protocol 6 (4)
48
A Sliding Window Protocol Using Selective Repeat
Protocol 6 (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.

49
Problem with non-sequential receive
  • Suppose that we have a 3-bit seq. number
  • The sender is permitted to send up to 7 frames
    before it is required to wait for an ACK
  • Initially, we have (a)
  • The sender transmits 0, 1, 2, 3, 4, 5, and 6
  • The receiver accepts any frame between 0 to 6
    (inclusive)
  • All seven frames arrive correctly, so the
    receiver acknowledges them and advances its
    window (b)
  • Suppose that all the ACKs are lost
  • The sender times out and retransmits frame 0
  • The receiver accepts this frame as it is within
    7, 0, , 5
  • The receiver sends a piggybacked ACK for frame 6,
    since 0, , 6 have been received previously.
  • The sender is happy that all its transmission are
    through and advances its window, and send 7, 0,
    , 5.
  • Receiver then sends from 7 and the old frame 0 to
    the network!!!
  • Therefore, the network gets an incorrect frame
    and the protocol fails!!

50
Agenda
  • Design Issues
  • Error Detection and Correction
  • Elementary Data Link Protocols
  • Sliding Window Protocols
  • Protocol Verification
  • Example Data Link Protocols
  • Summary

51
Protocol Verification
  • Finite State Machined Models
  • Petri Net Models

52
Finite State Machined Models
  • (a) State diagram for protocol 3. (b)
    Transmissions.

53
Petri Net Models
  • A Petri net with two places and two transitions.

54
Petri Net Models (2)
  • A Petri net model for protocol 3.

55
Agenda
  • Design Issues
  • Error Detection and Correction
  • Elementary Data Link Protocols
  • Sliding Window Protocols
  • Protocol Verification
  • Example Data Link Protocols
  • Summary

56
Example Data Link Protocols
  • HDLC High-Level Data Link Control
  • The Data Link Layer in the Internet

57
High-Level Data Link Control
  • Frame format for bit-oriented protocols.

58
High-Level Data Link Control (2)
  • Control field of
  • (a) An information frame.
  • (b) A supervisory frame.
  • (c) An unnumbered frame.

59
The Data Link Layer in the Internet
  • A home personal computer acting as an internet
    host.

60
PPP Point to Point Protocol
  • The PPP full frame format for unnumbered mode
    operation.

61
PPP Point to Point Protocol (2)
  • A simplified phase diagram for bring a line up
    and down.

62
PPP Point to Point Protocol (3)
  • The LCP frame types.

63
Agenda
  • Design Issues
  • Error Detection and Correction
  • Elementary Data Link Protocols
  • Sliding Window Protocols
  • Protocol Verification
  • Example Data Link Protocols
  • Summary

64
Summary
  • Data Link Layer
  • The task of data link layer is to convert the raw
    bit stream offered by the physical layer into a
    stream of frames for use by the network layer.
  • Framing methods character count, byte and bit
    stuffing.
  • It provides error control, flow control
  • Protocols
  • Protocols 1 to 6
  • Sliding window protocols
  • Protocol Verification FSMs Petri Nets
  • Examples SDLC, HDLC, and PPP.
Write a Comment
User Comments (0)
About PowerShow.com