0% found this document useful (0 votes)
16 views

The Data Link Layer

The document discusses various data link layer protocols. It begins by describing the services provided by the data link layer, including framing, error control, and flow control. It then discusses specific protocols such as unrestricted simplex, stop-and-wait, and sliding window protocols using go back N and selective repeat approaches. Error detection techniques like parity bits, CRC checksums, and error correcting codes are also summarized. The document provides examples to illustrate key concepts in a concise yet informative manner.

Uploaded by

13521145
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

The Data Link Layer

The document discusses various data link layer protocols. It begins by describing the services provided by the data link layer, including framing, error control, and flow control. It then discusses specific protocols such as unrestricted simplex, stop-and-wait, and sliding window protocols using go back N and selective repeat approaches. Error detection techniques like parity bits, CRC checksums, and error correcting codes are also summarized. The document provides examples to illustrate key concepts in a concise yet informative manner.

Uploaded by

13521145
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

The Data Link Layer

Chapter 3
Data Link Layer Design Issues
P Services Provided to the Network Layer
P Framing
P Error Control
P Flow Control
Functions of the Data Link Layer
P Provide service interface to the network layer
P Dealing with transmission errors
P Regulating data flow
< Slow receivers not swamped by fast senders
Functions of the Data Link Layer (2)

P Relationship between packets and frames.


Services Provided to Network Layer

P (a) Virtual communication.


P (b) Actual communication.
Actual Services
P Unacknowledge connectionless service
P Acknowledge connectionless service
< Frames are acknowledged
< Timers are used
P Acknowledge connection-oriented service
< Connection established
< Counter and timers are used
< Each frame is numbered
< Data link guarantee delivery
< Guarantee only one frame is received
< Received in the right order
Services Provided to Network Layer (2)

P Placement of the data link protocol.


Framing

P Raw bit stream from physical layer are not error free
P The number of bits may be less than, equal to, or more than the
number of bits transmitted
P Data link must detect and correct
P The usual approach
< Break bit stream into frames
< Compute checksum for each frame
< Checksum is recomputed at the receiver and compared
Framing

Character count

P A character stream. (a) Without errors. (b) With one error.


P Can not resynchronize
Framing
Flag byte with byte stuffing

P (a) A frame delimited by flag bytes.


P When a data is the same as the flag or esc then do byte stuffing
P (b) Four examples of byte sequences before and after stuffing.
< Flag -> Esc Flag
< Esc -> Esc Esc
Framing

P Bit stuffing
P Assume flag : 01111110 (1 zero, 6 ones, 1 zero)
P (a) The original data.
P When a sequence of 5 ones appear then stuff a zero (0)
P (b) The data as they appear on the line.
P (c) The data as they are stored in receiver's memory after
destuffing.
P Resynch -> find flag
Framing
Use redundancy
P Use two bits to transmit 1 bit
P 0 is transmitted as 01
P 1 is transmitted as 10
P No 00 or 11
P 00 or 11 can be used to delimit frames
Error Control and Flow Control

P Error Control:
< Ensure reliability -> need feedback
< Protocol requires somekind of acknowledgement
< Complication: frame can vanish
< Don’t wait forever -> use timer
– Acknowledgement must received before timer expires
< Acknowlegement frame can be lost -> send frame again
< Danger! Multiple frames -> use sequence number for each frame
P Flow Control
< Feedback-based
< Rate-based
Error Detection and Correction
P Error-Correcting Codes
< Include enough redundant information along with data so that the
receiver can correct the error
P Error-Detecting Codes
< Include enough redundant information along with data so that the
receiver can detect an error
Error Type
P Isolated: 0 -> 1, or 1 -> 0

P Burst: errors in consecutive bits


< 2 or more bits in the data unit have changed
Error Detection and Correction
Finding Hamming Distance
P Number of bit positions in which two codewords differs
P Example:
< 10001001
< 10110001
P Hamming distance = ?
< Can use XOR to find it
Hamming Distance Example

P Parity bit
P Error detection
P Added to data so that number of 1 bits in codeword is
P Even (even parity)
P Odd (odd parity)
P E.g., ASCII of ‘H’ is 1001000, its codeword is
P ________ if even parity is used
P ________ if odd parity is used
P Parity code’s Hamming distance = _
Error-Correcting Codes

P Use of a Hamming code to correct


burst errors.
P m-bit of data
P r-bit of redundant check bits
P Total length n = m+r bits or n-
bit codeword
P d single-bit error need d+1
codeword
P d double-bit error need 2d+1
codeword
P How many bit for r?
< (n+1)2 m # 2 n
< (m+r+1)2 m # 2 m+r
< (m+r+1)2 m # 2 m2 r
< (m+r+1) # 2 r
Hamming Code

P Hamming Code (m+r, r)


P For m-bit data we need r-bit redundancy, where (m+r+1) # 2 r
P Redundancy bits are placed in position of 2’s power
P Example: If m = 7, then r = 4
Example
Hamming code (11,4) -> m=7 and r=4

P Wants to send a message (111 0010)

P We need to find the bits for location 1,2,4, and 8


Example (cont)
P Find which redundancy bit will affects which message bits
< Message bit 3 will be affected by redundancy bits 1 and 2 because
3 = 2+1
< 5 = 4+1 (redundancy bits 4 and 1 affects message bit 5)
< 6 = 4+2
< 7 = 4+2+1
< 9 = 8+1
< 10 = 8+2
< 11 = 8+2+1
P To summarize
< Redundancy bit 1 affects message bits 3, 5, 7, 9, and 11
< Redundancy bit 2 affects message bits 6, 7, 10, and 11
< Redundancy bit 4 affects message bits 5, 6, and 7
< Redundancy bit 8 affects message bits 9, 10, and 11
Example (cont.)
P So to get R 1
< Look at M 3, M 5, M 7, M 9, M 11
< They are 0, 1, 0, 1, 1 -> 3 ones
< Assuming even parity then we need to even up the number of ones
< Therefore R 1 is 1
P So to get R 2
< Look at M 6, M 7, M 10, M 11
< They are 0, 0, 1, 1 -> 2 ones
< Therefore R 2 is 0
P So to get R 4
< Look at M 5, M 6, M 7
< They are 1, 0, 0 -> 1 ones
< Therefore R 4 is 1
P So to get R 8
< Look at M 9, M 10, M 11
< They are 1, 1, 1 -> 3 ones
< Therefore R 8 is 1
Example (cont.)
P Sent bits
Error-Detecting Codes
P Calculation of the polynomial code
checksum
P CRC :
< Transmitter and receiver must
agree on generator polynomial
G(x)
< Example
– G(x) = x 4 + x + 1
– 1 0 0 1 1 divisor
– If r is the highest degree of
G(x), append r zero bits to the
lower-end of message
– Divide and the remainder is the
r bit appended to the lower end
of the message
< When received, the message is
divided by G(x). If remainder is
zero 6 no errror
Example of CRC

P CRC-8 : 1 0000 0111


P CRC-16 : 1 1000 0000 0000 0101
P CRC-CCITT : 1 0001 000 0010 0001
P CRC-32 : 1 0000 0100 1100 0001 0001 1101 1011 0111
Elementary Data Link Protocols

P An Unrestricted Simplex Protocol


P A Simplex Stop-and-Wait Protocol
P A Simplex Protocol for a Noisy Channel
Protocol Definitions

P Some definitions needed in the protocols to follow. These are


located in the file protocol.h.
Protocol Definitions (ctd.)

P Some definitions
needed in the
protocols to follow.
These are located
in the file
protocol.h.
Unrestricted Simplex Protocol
No loss, never damaged

(A) (B)
P (A) transmitter
P (B) receiver
Simplex Stop-and-Wait Protocol
No Error, simplex traffic, but prevent flood

P (A) transmitter
< Need to wait for ack from
receiver
P (B) receiver
< After receiving a data send
an ack

(A) (B)
A Simplex Protocol for a Noisy Channel

P Error in channel
P Transmitter
< A positive acknowledgement
with retransmission protocol.
< Retransmit until correctly
received
P Positive Acknowledgement with
Retransmission (PAR) or
Automatic Repeat reQuest (ARQ)
P 1 bit sequence number
P If 0 is the current sequence
number then 1 is the next
sequence number and (1 -> 0)
A Simplex Protocol for a Noisy Channel

P Receiver
< A positive acknowledgement
with retransmission protocol.
Sliding Window Protocols
Bidirectional
P To achieve full-duplex :
< Two channel (one for each direction)
< Same channel (or circuit) for both direction
< Data are intermixed with acknowledgement
P Interleaving data and control are possible
P Piggiback is also possible (wait to send)
P Protocols:
< A One-Bit Sliding Window Protocol
< A Protocol Using Go Back N
< A Protocol Using Selective Repeat
Sliding Window Protocols

New packet
given the next
highest sequence
number

P n-bit sequence number 0 to 2 n-1


P A sliding window of size 1, with a 3-bit sequence number.
P (a) Initially.
P (b) After the first frame has been sent.
P (c) After the first frame has been received.
P (d) After the first acknowledgement has been received.
A One-Bit Sliding Window Protocol
A One-Bit Sliding Window Protocol (ctd.)
A One-Bit Sliding Window Protocol (2)

P 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.
A Protocol Using Go Back N
Pipelining
P Pipelining
< channel capacity b bps
< frame size is l
< round-trip propagation time is R sec
< Time to transmit = l/b

< line utilization


A Protocol Using Go Back N

Pipelining
+ channel capacity b bps
+ frame size is l
+ round-trip propagation
time is R sec
+ Time to transmit = l/b
+ line utilization =

P Pipelining and error recovery. Effect on an error when


P (a) Receiver's window size is 1.
P (b) Receiver's window size is large.
Sliding Window Protocol Using Go Back N
Sliding Window Protocol Using Go Back N
Sliding Window Protocol Using Go Back N
Sliding Window Protocol Using Go Back N
Sliding Window Protocol Using Go Back N
(2)

P Simulation of multiple timers in software.


A Sliding Window Protocol Using Selective
Repeat
A Sliding Window Protocol Using Selective
Repeat (2)
A Sliding Window Protocol Using Selective
Repeat (3)
A Sliding Window Protocol Using Selective
Repeat (4)
A Sliding Window Protocol Using Selective
Repeat (5)

P (a) Initial situation with a window size seven.


P (b) After seven frames sent and received, but not acknowledged.
P (c) Initial situation with a window size of four.
P (d) After four frames sent and received, but not acknowledged.
Protocol Verification

P Finite State Machined Models


P Petri Net Models
Finite State Machined Models

P (a) State diagram for protocol 3. (b) Transmissions.


Petri Net Models

P A Petri net with two places and two transitions.


Petri Net Models (2)

P A Petri net model for protocol 3.


Example Data Link Protocols
P HDLC – High-Level Data Link Control
P The Data Link Layer in the Internet
High-Level Data Link Control

P Frame format for bit-oriented protocols.


P Address identify terminal
P Control sequence number or ack or other
P Data
P Checksum uses CRC-16
P Uses Sliding window 3 bit
High-Level Data Link Control (2)

P Control field of
P (a) An information frame.
P (b) A supervisory frame.
P (c) An unnumbered frame.
The Data Link Layer in the Internet

P A home personal computer acting as an internet host.


PPP – Point to Point Protocol

P The PPP full frame format for unnumbered mode operation.


PPP – Point to Point Protocol (2)

P A simplified phase diagram for bring a line up and down.


PPP – Point to Point Protocol (3)

P The LCP frame types.

You might also like