Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Link Layer RAHUL DEVA.

Similar presentations


Presentation on theme: "Data Link Layer RAHUL DEVA."— Presentation transcript:

1 Data Link Layer RAHUL DEVA

2 The Data Link Layer Framing Error Control Flow Control
Error Correction Error Detection Flow Control Retransmission with Sliding Window Protocols Protocol Specification and Verification Example Data Link Protocols

3 Data Link Layer Services
Unacknowledged connectionless service Voice Acknowledged connectionless service wireless Acknowledged connection-oriented service no out-of-order

4 Framing To break the bit stream up into discrete frames and compute the checksum for each frame. When a frame arrives at the destination, the checksum is recomputed and validated. One way to achieve this framing is to insert time gaps between frames. However, networks rarely make any guarantees about timing.

5 Error Control Three types of frames at a receiver’s end
Damaged frame: Negative acknowledgment / retransmission Lost frame: Time-out mechanism Valid frame: Sequence numbering / discarding for valid but duplicate frames

6 Flow Control A technique for assuring that a transmitting station does not overwhelm a receiving station with data

7 Data Framing Character count
Starting and ending characters with character stuffing Starting and ending flags with bit stuffing Physical layer coding violations

8 Character Count character count frame 1 5 characters frame 2 frame 3 8 characters frame 4 frame 2 (wrong) frame 1 5 characters one-bit error Now a character count Even if the checksum is incorrect so the destination knows that the frame is bad, it still has no way of telling where the next frame starts.

9 Starting and Ending Characters with Character Stuffing
DLE STX user data DLE ETX beginning of frame end of frame DLE(0x10): Data Link Escape STX(0x02): Start of TeXt ETX(0x03): End of TeXt DLE STX A DLE B DLE ETX user data 0x10 DLE stuffed at the sender DLE destuffed at the receiver DLE STX A DLE DLE B DLE ETX

10 Starting and Ending Flags with Bit Stuffing
user data beginning of frame end of frame flag bits stuffed at the sender bits destuffed at the receiver original data

11 Introduction: Error Detection and Correction
It is physically impossible for any data recording or transmission medium to be 100% perfect over its entire expected useful life. Noise is always present If a communications line experiences too much noise, the signal will be lost or corrupted Communication systems should check for transmission errors Once an error is detected, a system may perform some action Some systems perform no error control, but simply let the data in error be discarded

12 Noise Also known as thermal or Gaussian noise
Relatively constant and can be reduced If noise gets too strong, it can completely disrupt the signal

13 Noise (continued)

14 The effect of impulse noise on a digital signal
One of the most disruptive forms of noise Random spikes of power that can destroy one or more bits of information Difficult to remove from an analog signal because it may be hard to distinguish from the original signal Impulse noise can damage more bits if the bits are closer together (transmitted at a faster rate) The effect of impulse noise on a digital signal

15 Three Telephone Circuits experiencing crosstalk
Unwanted coupling between two different signal paths For example, hearing another conversation while talking on the telephone Relatively constant and can be reduced with proper measures Three Telephone Circuits experiencing crosstalk

16 A signal bouncing back at the end of a cable and causing echo
The reflective feedback of a transmitted signal as the signal moves through a medium Most often occurs on coaxial cable If echo bad enough, it could interfere with original signal Relatively constant, and can be significantly reduced A signal bouncing back at the end of a cable and causing echo

17 Original digital signal and digital signal with jitter
The result of small timing irregularities during the transmission of digital signals Occurs when a digital signal is repeated over and over If serious enough, jitter forces systems to slow down their transmission Steps can be taken to reduce jitter Original digital signal and digital signal with jitter

18 Delay Distortion Occurs because the velocity of propagation of a signal through a medium varies with the frequency of the signal Can be reduced

19 Attenuation The continuous loss of a signal’s strength as it travels through a medium

20 Error Prevention (continued)

21 Error Detection Despite the best prevention techniques, errors may still happen To detect an error, something extra has to be added to the data/signal This extra is an error detection code Three basic techniques for detecting errors: parity checking, arithmetic checksum, and cyclic redundancy checksum

22 Parity Checks Simple parity
If performing even parity, add a parity bit such that an even number of 1s are maintained If performing odd parity, add a parity bit such that an odd number of 1s are maintained For example, send using even parity For example, send using even parity

23 Parity Checks (continued)
Simple parity (continued) What happens if the character is sent and the first two 0s accidentally become two 1s? Thus, the following character is received: Will there be a parity error? Problem: Simple parity only detects odd numbers of bits in error

24 Parity Checks (continued)
Longitudinal parity Adds a parity bit to each character then adds a row of parity bits after a block of characters The row of parity bits is actually a parity bit for each “column” of characters The row of parity bits plus the column parity bits add a great amount of redundancy to a block of characters

25 Vertical Redundancy Check (VRC)
Append a single bit at the end of data block such that the number of ones is even  Even Parity (odd parity is similar)   VRC is also known as Parity Check Performance: Detects all odd-number errors in a data block

26 Longitudinal Redundancy Check (LRC)
Organize data into a table and create a parity for each column Original Data LRC

27 Longitudinal Redundancy Check and Vertical Redundancy Check
27 VRC LRC

28 Parity Checks (continued)
Both simple parity and longitudinal parity do not catch all errors Simple parity only catches odd numbers of bit errors Longitudinal parity is better at catching errors but requires too many check bits added to a block of data We need a better error detection method What about arithmetic checksum?

29 Modulo 2 Modulo 2 arithmetic works like clock arithmetic. In clock arithmetic, if we add 2 hours to 11:00, we get 1:00. In modulo 2 arithmetic if we add 1 to 1, we get 0. The addition rules couldn’t be simpler: 0 + 0 = = 1 1 + 0 = = 0

30 Find the quotient and remainder when 1111101 is divided by 1101 in modulo 2 arithmetic.
As with traditional division, we note that the dividend is divisible once by the divisor. We place the divisor under the dividend and perform modulo 2 subtraction.

31 Error Detection and Correction
Find the quotient and remainder when is divided by 1101 in modulo 2 arithmetic… Now we bring down the next bit of the dividend. We see that is not divisible by So we place a zero in the quotient.

32 Error Detection and Correction
Find the quotient and remainder when is divided by 1101 in modulo 2 arithmetic… 1010 is divisible by in modulo 2. We perform the modulo 2 subtraction.

33 Error Detection and Correction
Find the quotient and remainder when is divided by 1101 in modulo 2 arithmetic… We find the quotient is 1011, and the remainder is 0010. This procedure is very useful to us in calculating CRC syndromes. Note: The divisor in this example corresponds to a modulo 2 polynomial: X 3 + X

34 Cyclic redundancy checking (CRC)
Suppose we want to transmit the information string: The receiver and sender decide to use the (arbitrary) polynomial pattern, 1101. The information string is shifted left by one position less than the number of positions in the divisor. The remainder is found through modulo 2 division (at right) and added to the information string: =

35 Cyclic redundancy checking (CRC)
If no bits are lost or corrupted, dividing the received information string by the agreed upon pattern will give a remainder of zero. We see this is so in the calculation at the right. Real applications use longer polynomials to cover larger information strings. Some of the standard poly-nomials are listed in the text.

36 Hamming codes The minimum Hamming distance for a code, D(min), determines its error detecting and error correcting capability. For any code word, X, to be interpreted as a different valid code word, Y, at least D(min) single-bit errors must occur in X. Thus, to detect k (or fewer) single-bit errors, the code must have a Hamming distance of D(min) = k + 1.

37 Flow Control and Error Control
A set of procedures that tells the sender how much data can be sent before waiting for acknowledgment Error control Includes both error detection and correction Allows receiver to inform sender of lost or duplicate frames Mostly based on Automatic Repeat Request (ARQ)

38 Data Link Protocols

39 Protocols for Noiseless Channel
Assuming channel is error free Not realistic… No need for error control

40 "Simplest" Mechanism Assuming Noiseless channel
Unlimited buffer and speed for the receiver

41 "Simplest" : Pseudo Code Sender Receiver

42 "Simplest": Flow Diagram

43 Stop-and-Wait Mechanism
Still noiseless channel Receiver has limited buffer Requires flow control Sender sends one frame at a time and wait for an acknowledgment

44 Stop-and-Wait: Overview

45 Stop-and-Wait: Pseudo Code
Sender side

46 Stop-and-Wait: Pseudo Code
Receiver side

47 Stop-and-Wait: Flow Diagram

48 Noisy Channel Realistic Error can and will happen Require error control Mechanisms: Stop-and-Wait ARQ Go-Back-N ARQ Selective Repeat ARQ

49 Stop-and-Wait ARQ Sender keeps a copy of sent frame until successful delivery is ensured Receiver responds with an ack when it successfully receives a frame Both data and ack frames must be numbered. (For identification purpose, both data frames and ACK frames are numbered alternately 0 and 1.) When sender does not receive an ack within certain time, it assumes frame is lost, then retransmits the same frame.

50 Stop-and-Wait ARQ

51 Flow Diagram: Normal Operation
Sender Receiver S = 0 R = 0 Frame 0 Deliver ACK 1 R = 1 S = 1 Frame 1 Deliver ACK 0 R = 0 Time Time

52  Thinking Corner Why data frames need to be numbered?

53 Flow Diagram: Lost Frame
Sender Receiver S = 0 R = 0 Frame 0 Deliver ACK 1 R = 1 S = 1 Frame 1 Timeout Frame 1 Deliver ACK 0 R = 0 Time Time

54 Frame 0 expected; discard
Flow Diagram: Lost ACK Sender Receiver S = 0 R = 0 Frame 0 Deliver ACK 1 R = 1 S = 1 Frame 1 Timeout Deliver ACK 0 R = 0 S = 1 Frame 1 Frame 0 expected; discard ACK 0 R = 0 S = 0 Time Time

55 Flow Diagram: Delayed ACK
Sender Receiver S = 0 R = 0 Frame 0 Timeout Deliver ACK 1 R = 1 Frame 0 Frame 0 expected; discard S = 1 ACK 1 Frame 1 Timeout R = 1 Frame 1 Deliver ACK 0 R = 0 S = 0

56 Bidirectional Transmission
Data are transferred both ways ACK are "piggybacked" with data frames

57 Improving Link Utilization
Previous example demonstrates major disadvantage of Stop-and-Wait ARQ Prefer to send more frames before waiting for ACK Example: Recalculate the link utilization if we allow up to 15 frames to be sent before waiting for an ACK

58 Go-Back-N ARQ Allows multiple frames to be sent before waiting for ACK
These frames must be numbered differently Frame numbers are called Sequence numbers Frames must be received in the correct order If a frame is lost, the lost frame and all of the following frames must be retransmitted

59 Sequence Numbers Frame header contains m bits for sequence number
That allows up to 2m different frame numbers How big should m be?

60 Sending Window Sending more than one frame at once requires sender to buffer multiple frames Known as "sending window" Any of these frames in the window can be lost

61 "Sliding" Window Once the first frames in the window is ACKed
ACKed frames are removed from the buffer More frames are transmitted Result: The window slides to the right

62 Receiving Window Receiver expects one frame at a time

63 Send vs. Receive Windows

64 Go-Back-N: Window Sizes
For m-bit sequence numbers Send window size: at most 2m-1  Up to 2m-1 frames can be sent without ACK Receive window size: 1  Frames must be received in order

65 Go-Back-N: Normal Operation

66 Go-Back-N: Lost Frame ACKs are cumulative

67 Lost ACK: Window Size < 2m

68 Lost ACK: Window Size = 2m

69 Selective Repeat ARQ Go-Back-N always discards out-of-order frames
Losing one frame may result in retransmission of multiple frames Very inefficient in noisy link Selective Repeat ARQ allows frames to be received out of order Therefore, receive window > 1

70 Send and Receive Windows
Sender and receiver share window space equally For m-bit sequence numbers Send window: up to 2m-1 Receive window: up to 2m-1

71 Send Window

72 Receive Window

73 Negative ACK Used by receiver to indicate missing frame

74 Selective Repeat: Window Size


Download ppt "Data Link Layer RAHUL DEVA."

Similar presentations


Ads by Google