Top Banner
Reference Model
87

Ntdd

May 10, 2015

Download

Technology

DIKSHA_LAHRANI
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ntdd

Reference Model

Page 2: Ntdd

Data Link layer• Data link Layer

– explicit in OSI– can be synchronous or asynchronous

• Reliable & Efficient Data Transfer (over a point-to-point link)– Error Detection, Error Recovery, Flow Control

• Protocol performance governed by– propagation delay– bit-rate & frame size– noise

• Provide service interface to the network layer• Regulating data flow

– Slow receivers not swamped by fast senders

Page 3: Ntdd
Page 4: Ntdd
Page 5: Ntdd

(a) Virtual communication.(b) Actual communication.

Page 6: Ntdd
Page 7: Ntdd

Services offered to Network Layer

• Unacknowledged connectionless service

– Sender has no way of knowing if a frame has been successfully delivered

– No logical connection is established– Appropriate for low error rate and real-time traffic– Losses are taken care at higher levels– Used on reliable medium like coax cables or optical fiber, where

the error rate is low.– Appropriate for voice, where delay is worse than bad data.– Most LANs use it

Page 8: Ntdd

Acknowledged Connectionless service

• Useful on unreliable medium like wireless.• Acknowledgements add delays.• Adding ack in the DLL rather than in the NL is just an

optimization and not a requirement. Leaving it for the NL is inefficient as a large message (packet) has to be resent in that case in contrast to small frames here.

• On reliable channels, like fiber, the overhead associated with the ack is not justified.

• No logical connection still, but each individual frame is acknowledged

• Appropriate for WLANs

Page 9: Ntdd

Acknowledged Connection-oriented service

• Most reliable,

• Guaranteed service – Each frame sent is indeed received– Each frame is received exactly once– Frames are received in order

• Special care has to be taken to ensure this in connectionless services

Page 10: Ntdd

1 2 3 4 5

Data Data Data

ACK/NAK

Data

1 2 3 4 5

Data Data Data Data

ACK/NAK

ACK/NAK

ACK/NAK

ACK/NAK

End to End

Hop by Hop

Page 11: Ntdd

Data Link Frames

• General Frame format

Page 12: Ntdd

Data Link Frames

• Start and End of frames need to be identified at the destination, so they should be marked

– Character counts– Start and ending flags with bit stuffing– Flag bytes with byte stuffing– Physical layer coding violation

Page 13: Ntdd

Framing with Character Count

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

Page 14: Ntdd

Problem with Framing with CC

• What if the count is garbled

• Even if with checksum, the receiver knows that the frame is bad there is no way to tell where the next frame starts.

• Asking for retransmission doesn’t help either because the start of the retransmitted frame is not known

• No longer used

Page 15: Ntdd

Framing with bit stuffing

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.

Page 16: Ntdd

Framing with byte stuffing

Page 17: Ntdd

Framing with byte stuffing

• Problem : fixed character size : assumes character size to be 8 bits : can’t handle heterogeneous environment.

Page 18: Ntdd

Physical Layer codingviolations

• Some LANs encode 1 bit of data by using 2

physical bits– Normally, a 1 bit is a high-low pair and a 0 bit is a

low-high pair

– The start/end of a frame could be represented by

the signal low-low or high-high

• The advantage is that no extra bandwidth is

required as in byte stuffing• The IEEE 802.4 standard uses this approach

Page 19: Ntdd

Types of Errors• Single-Bit Error

– only one bit in the data unit has changed• Burst Error

– 2 or more bits in the data unit have changed• Error Correcting Codes

– Include enough redundancy to detect and correct errors

– appropriate for unreliable channels• Error Detecting Codes

– Include enough redundancy bits to detect errors and use

– ACKs and retransmissions to recover from the errors

– Appropriate for reliable channels

Page 20: Ntdd
Page 21: Ntdd

Error Detection and Correction

• In some cases it is sufficient to detect an error and in some, it requires the errors to be corrected also. For eg.– On a reliable medium : ED is sufficient where

the error rate is low and asking for retransmission after ED would work efficiently

– In contrast, on an unreliable medium : Retransmission after ED may result in another error and still another and so on. Hence EC is desirable.

Page 22: Ntdd

Redundancy

• Error detection uses the concept of redundancy, which means adding extra bits for detecting errors at the destination

Page 23: Ntdd
Page 24: Ntdd
Page 25: Ntdd

Even-parity concept

Page 26: Ntdd

NoteNote::

• In parity check, a parity bit is added to every data unit so that the total number of 1s is even (or odd for odd-parity).

• This method is called Vertical Redundancy Check

Page 27: Ntdd

Example 1Example 1• Suppose the sender wants to send the word world. In ASCII

the five characters are coded as

1110111 1101111 1110010 1101100 1100100• The following shows the actual bits sent

11101110 11011110 11100100 11011000 11001001

• Now suppose the word world in Example 1 is received by the receiver without being corrupted in transmission.

11101110 11011110 11100100 11011000 11001001

•The receiver counts the 1s in each character and comes up with even numbers (6, 6, 4, 4, 4). The data are accepted.

Page 28: Ntdd

• Now suppose the word world in Example 1 is corrupted during transmission.

• 11111110 11011110 11101100 11011000 11001001

• The receiver counts the 1s in each character and comes up with even and odd numbers (7, 6, 5, 4, 4). The receiver knows that the data are corrupted, discards them, and asks for retransmission.

Page 29: Ntdd

NoteNote::

• Simple parity check can detect all Simple parity check can detect all single-bit errors. It can detect burst single-bit errors. It can detect burst errors only if the total number of errors errors only if the total number of errors in each data unit is odd.in each data unit is odd.

Page 30: Ntdd

LRC

• In two-dimensional parity check, a block of bits is divided into rows and a redundant row of bits is added to the whole block.

Page 31: Ntdd

Two-dimensional parity(Longitudinal redundancy check)

Page 32: Ntdd

Example 2Example 2• Suppose the following block is sent: 10101001 00111001 11011101 11100111

10101010

• However, it is hit by a burst noise of length 8, and some bits are corrupted.

10100011 10001001 11011101 11100111 10101010

• When the receiver checks the parity bits, some of the bits do not follow the even-parity rule and the whole block is discarded.

10100011 10001001 11011101 11100111 10101010

Page 33: Ntdd

CRC generator and checker

Page 34: Ntdd

Binary division in a CRC generator

Page 35: Ntdd

Binary division in CRC checker

Page 36: Ntdd

Polynomial

Page 37: Ntdd

Standard Polynomials

Name Polynomial Application

CRC-8CRC-8 x8 + x2 + x + 1 ATM header

CRC-10CRC-10 x10 + x9 + x5 + x4 + x 2 + 1 ATM AAL

ITU-16ITU-16 x16 + x12 + x5 + 1 HDLC

ITU-32ITU-32x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5

+ x4 + x2 + x + 1LANs

Page 38: Ntdd

Checksum

Page 39: Ntdd

Checksum

• The sender follows these steps:The sender follows these steps:– The unit is divided into k sections, each of n The unit is divided into k sections, each of n

bits.bits.– All sections are added using one’s All sections are added using one’s

complement to get the sum.complement to get the sum.– The sum is complemented and becomes the The sum is complemented and becomes the

checksum.checksum.– The checksum is sent with the data.The checksum is sent with the data.

Page 40: Ntdd

Checksum

• The receiver follows these steps:The receiver follows these steps:– The unit is divided into k sections, each of n The unit is divided into k sections, each of n

bits.bits.– All sections are added using one’s All sections are added using one’s

complement to get the sum.complement to get the sum.– The sum is complemented.The sum is complemented.– If the result is zero, the data are accepted: If the result is zero, the data are accepted:

otherwise, rejected.otherwise, rejected.

Page 41: Ntdd

Checksum• Suppose the following block of 16 bits is to be

sent using a checksum of 8 bits. 10101001 00111001 • The numbers are added using one’s

complement 10101001 00111001

------------Sum 11100010

• Checksum 00011101• The pattern sent is 10101001 00111001

00011101

Page 42: Ntdd

Checksum• Now suppose the receiver receives the pattern

sent in Example and there is no error. 10101001 00111001 00011101• When the receiver adds the three sections, it will

get all 1s, which, after complementing, is all 0s and shows that there is no error.

• 10101001• 00111001 • 00011101 • Sum 11111111 • Complement 00000000 means that the

pattern is OK.

Page 43: Ntdd

Checksum

• Now suppose there is a burst error of length 5 that affects 4 bits.

10101111 11111001 00011101• When the receiver adds the three sections, it gets

1010111111111001 00011101

• Partial Sum 1 11000101• Carry 1• Sum 11000110 • Complement 00111001 the pattern is corrupted.

Page 44: Ntdd

CorrectionCorrection

• Backword Error Control– Retransmission

• Forward Error Control– Single bit Error Correction– Burst Error Correction

Page 45: Ntdd

Hamming Codes : for ED n EC

• m data bits together with r error check bits form an n = (m + r) bit codeword

• The number of bits two codeword differ in is called the hamming distance between the two codeword

• Significance : If two codeword are at HD d then it requires d single bit errors to convert one into the other

Page 46: Ntdd

HD of a coding scheme

• For m bit data .. All the 2^m possible combinations are legal

• But not all the 2^m codewords are used -- in a coding scheme (algorithm to compute the check

bits) some of these codewords are legal and others are illegal

For eq .. Consider parity : 1(r = 1) parity bit is appended with value so that the total number of 1’s in the codeword is even ..

Then 11011 is a legal codeword in this scheme but 11010 is not

Page 47: Ntdd

Use of HD for error detection

• To detect d single bit errors , we need (an algorithm that creates) a code list with HD at least d + 1

For eg . For the parity scheme .. HD is 2 ..hence it can be used to detect single bit errors (d=1)

• If the recvd codeword is legal .. We accept it ,• And if it is illegal we report (detect) an error

Remember : Each algorithm to compute the check bits create a different list of legal codewords

Page 48: Ntdd

Data and redundancy bitsData and redundancy bitsHamming CodeHamming Code

Number ofdata bits

m

Number of redundancy bits

r

Total bits

m + r

11 2 3

22 3 5

33 3 6

44 3 7

55 4 9

66 4 10

77 4 11

Page 49: Ntdd

Positions of redundancy bits in Hamming code

Page 50: Ntdd

Redundancy bits calculation

Page 51: Ntdd

Example of redundancy bit calculation

Page 52: Ntdd

Error detection using Hamming code

Page 53: Ntdd

Burst error correction example

Page 54: Ntdd

Flow and Error ControlFlow and Error Control

• Flow Control Flow control refers to a set of procedures used to Flow control refers to a set of procedures used to

restrict the amount of data that the sender can restrict the amount of data that the sender can send before waiting for acknowledgment.send before waiting for acknowledgment.

• Error Control

Error control in the data link layer is based on Error control in the data link layer is based on automatic repeat request, which is the automatic repeat request, which is the retransmission of data (Backward Error Control).retransmission of data (Backward Error Control).

Page 55: Ntdd

Flow Control

• Ensure sending entity does not overwhelm receiving entity

– By preventing buffer overflow• Influenced by:

– Transmission time• time taken to emit all bits into medium

– Propagation time• time for a bit to traverse the link• Assume here no errors but varying delays

Page 56: Ntdd

Stop and Wait Flow Control

• Source transmits frame• Destination receives frame and replies with acknowledgement (ACK)• Source waits for ACK before sending next• Destination can stop flow by not send ACK• Works well for a few large frames• Stop and wait becomes inadequate if large block of data is split into small frames

Page 57: Ntdd

Sliding Windows Flow Control

• Allows multiple numbered frames to be in transit

• Receiver has buffer W long

• Transmitter sends up to W frames without ACK

• ACK includes number of next frame expected

• Receiver can ack frames without permitting

further transmission (Receive Not Ready)

• Must send a normal acknowledge to resume

• If have full-duplex link, can piggyback ACks

Page 58: Ntdd
Page 59: Ntdd
Page 60: Ntdd

Error Control

• Detection and correction of errors such as:

– Lost frames

– Damaged frames

• Common techniques use:

– Error detection

– Positive acknowledgment

– Retransmission after timeout

– Negative acknowledgement & retransmission

Page 61: Ntdd

Elementary Data Link Protocols

• An Unrestricted Simplex Protocol

• A Simplex Stop-and-Wait Protocol

• A Simplex Protocol for a Noisy Channel

Page 62: Ntdd

An Unrestricted Simplex Protocol• Transmitting and receiving NW layers are

always ready• Simplex transmission• Processing time ignored• Infinite buffer space• Error free channel• No sequence numbers and ACKs used• Sender

– Fetch a packet, construct a frame, send the frame

• Receiver– Receives the undamaged frame from the

physical layer.

Page 63: Ntdd

A Simplex Stop-and-Wait Protocol

• Communication in one direction• Channel is assumed to be error free• Deals with

– preventing the sender from flooding the receiver with data faster than later is able to process them

• ACK is used– Sender sends data frame– Receiver sends ACK (dummy frame)– Sender sends the next frame

Page 64: Ntdd

Stop-and-Wait ARQ for Noisy ChannelStop-and-Wait ARQ for Noisy Channel

Page 65: Ntdd

Stop and Wait

• Source transmits single frame• Wait for ACK• If received frame damaged, discard it

– Transmitter has timeout– If no ACK within timeout, retransmit

• If ACK damaged,transmitter will not recognize it

– Transmitter will retransmit– Use alternate numbering and ACK0 / ACK1

Page 66: Ntdd

Stop-and-Wait ARQ, lost frame

Page 67: Ntdd

Stop-and-Wait ARQ, lost ACK frame

Page 68: Ntdd

Stop-and-Wait ARQ, delayed ACK• In Stop-and-Wait ARQ, numbering frames prevents the In Stop-and-Wait ARQ, numbering frames prevents the

retaining of duplicate framesretaining of duplicate frames• Numbered acknowledgments are needed if an Numbered acknowledgments are needed if an

acknowledgment is delayed and the next frame is lostacknowledgment is delayed and the next frame is lost

Page 69: Ntdd

Sliding Windows Flow Control

• Allows multiple numbered frames to be in transit• Receiver has buffer W long• Transmitter sends up to W frames without ACK• ACK includes number of next frame expected• Receiver can ack frames without permitting further transmission (Receive Not Ready)• Must send a normal acknowledge to resume• If have full-duplex link, can piggyback ACks

Page 70: Ntdd

Piggybacking

• To increase the utilization of the link

• Frames in reverse direction carry the

Ack for received frames– No separate frames for Ack

Page 71: Ntdd

Piggybacking

Page 72: Ntdd

Go-Back-N ARQGo-Back-N ARQ

• Based on sliding window• If no error, ACK as usual• Use window to control number of outstanding frames• If error, reply with rejection

– Discard that frame and all future frames until error frame received correctly– Transmitter must go back and retransmit that

frame and all subsequent frames

Page 73: Ntdd

Go Back N - Handling

• Damaged Frame– Error in frame i so receiver rejects frame i– Transmitter retransmits frames from i

• Lost Frame– Frame i lost and either

• Transmitter sends i+1 and receiver gets frame i+1 out of seq and rejects frame i• Or transmitter times out and send ACK with P bit set which receiver responds to with ACK i

– Transmitter then retransmits frames from i

Page 74: Ntdd

Go Back N - Handling

• Damaged Acknowledgement– Receiver gets frame i, sends ack (i+1) which is lost– Acks are cumulative, so next ack (i+n) may arrive

before transmitter times out on frame i– If transmitter times out, it sends ack with P bit set– Can be repeated a number of times before a reset procedure is initiated

• Damaged Rejection– Reject for damaged frame is lost– Handled as for lost frame when transmitter times out

Page 75: Ntdd

Go-Back-N ARQGo-Back-N ARQ

In Go-Back-N ARQ, the size of the sender In Go-Back-N ARQ, the size of the sender window must be less than 2window must be less than 2mm; the size ; the size

of the receiver window is always 1.of the receiver window is always 1.

Page 76: Ntdd

Sender sliding window

Page 77: Ntdd

Receiver sliding window

Page 78: Ntdd

Control variables

Page 79: Ntdd

Go-Back-N ARQ, normal operation

Page 80: Ntdd

Go-Back-N ARQ, lost frame

Page 81: Ntdd

Go-Back-N ARQ: sender window size

Page 82: Ntdd

Selective-Repeat ARQSelective-Repeat ARQ

• Also called selective reject ARQ• Only rejected frames are retransmitted• Subsequent frames are accepted by the receiver and buffered• Minimizes retransmission• Receiver must maintain large enough buffer• More complex logic in transmitter• Hence less widely used• Useful for satellite links with long propagation delays

Page 83: Ntdd

Selective Repeat ARQ, sender and receiver windows

Page 84: Ntdd

Selective Repeat ARQ, lost frame

Page 85: Ntdd

Selective Repeat ARQ

• In Selective Repeat ARQ, the size of the In Selective Repeat ARQ, the size of the sender and receiver window must be at sender and receiver window must be at most one-half of 2most one-half of 2mm..

Page 86: Ntdd

Selective Repeat ARQ, sender window size

Page 87: Ntdd

Buffer Requirement of ARQ• Stop-and-Wait:

– 1• Go-back-N:

–W+1• Selective Reject:

– 2W