57
Physical and Data-Link Layers Dr. Ramana I.I.T Rajasthan Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 1 / 57

Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

  • Upload
    lethuy

  • View
    222

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Physical and Data-Link Layers

Dr. Ramana

I.I.T Rajasthan

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 1 / 57

Page 2: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Outline of the Lectures

1 IntroductionEncoding Schemes

2 Digital Data Transmission TechniquesSynchronous Data Link Layer Protocols

3 Error ControlError DetectionError Correction

4 Flow ControlStop and WaitSliding WindowAutomatic Repeat Requests (ARQs)High-level Data Link Control Protocol

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 2 / 57

Page 3: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Introduction

Analog/Digital Data/Signal

Analog data is real world stuff like, audio/voice, video/image,temparature etc. Takes continuous values in some interval.Digital data is text or character strings. Takes discrete values.Signal - electromagnetic wave through which data is propagatedfrom one point to another.Analog signal - continuously varying electromagnetic wave. Itspower varies varies over a continuous range. That is the value ofthe signal is significant at each point in time.Digital signal is a sequence of discrete pulses. In other words it isa pulse train signal that switches between a discrete number ofvoltage levels. The value of the signal must be above or belowsome discrete threshold at any point in time.

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 3 / 57

Page 4: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Introduction

Analog and Digital Transmission

Analog Signals: Represent data with continuously varying electromagnetic wave

Digital Signals: Represent data with sequence of voltage pulses

Analog Data(voice sound waves)

Analog Signal

Digital Data(binary voltage pulses)

Analog Signal(modulated oncarrier frequency)

Telephone

Modem

Analog Signal Digital Signal

Digital Data Digital Signal

Codec

DigitalTransceiver

Analog and Digital Signaling of Analog and Digital Data

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 4 / 57

Page 5: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Introduction Encoding Schemes

Encoding/Modulation

Encoder Decoder

(a) Encoding onto a digital signal

x(t)

x(t)

t

g(t)g(t)

digital oranalog

Modulator Demodulator

(b) Modulation onto an analog signal

Encoding and Modulation Techniques

s(t)

fc(t)carrier

analog

digital

S(f)

ffc

m(t)m(t)

digital oranalog

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 5 / 57

Page 6: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Introduction Encoding Schemes

Issues

Bits, Buad, BandwidthBaseline Wander - Unable to distinguish pulsesClock Recovery - Unable to distinguish begining of bitsReceiver ComplexityError detection

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 6 / 57

Page 7: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Introduction Encoding Schemes

Encoding Techniques

0

NRZ-L

NRZI

Bipolar-AMI(most recent

preceding 1 bit hasnegative voltage)

Pseudoternary(most recent

preceding 0 bit hasnegative voltage)

Manchester

DifferentialManchester

Digital Signal Encoding Formats

1 0 0 1 1 0 0 0 1 1

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 7 / 57

Page 8: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Introduction Encoding Schemes

(Cont.)

5 bits = 5 msec

1 1 1 1 1

1 bit =1 signal element =

1 msec

1 signal element =0.5 msec

1 bit =1 msec

A Stream of Binary Ones at 1 Mbps

NRZI

Manchester

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 8 / 57

Page 9: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Introduction Encoding Schemes

(Cont.)

1

Bipolar-AMI

B8ZS

HDB3

1 0 0 0 0 0 0 0 0

0 0 0 V B 0 V B

0 0 0 V B 0 0 V

Encoding Rules for B8ZS and HDB3

B 0 0 V

1 1 0 0 0 0 0 1 0

B = Valid bipolar signalV = Bipolar violation

(odd number of 1ssince last substitution)

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 9 / 57

Page 10: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Introduction Encoding Schemes

Bipolar with Eight-Zero Substitution

The bipolar-AMI encoding supplemented with a scramblingscheme, which uses two code violations to ensuresynchronization in runs of 0’s.

Replace ‘00000000’ with ‘000+-0-+’, if the preceding voltage pulsewas positiveReplace ‘00000000’ with ‘000-+0+-’, if the preceding voltage pulsewas not positive

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 10 / 57

Page 11: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Introduction Encoding Schemes

High Density Bipolar Three

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 11 / 57

Page 12: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Introduction Encoding Schemes

Examples

(B8ZS Example)

(HDB3 Example)

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 12 / 57

Page 13: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Digital Data Transmission Techniques

Parallel TransmissionsSerial Transmission

AsynchronousSynchronous

(Parallel)

(Serial)

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 13 / 57

Page 14: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Digital Data Transmission Techniques

(Cont.)

Asynchronous Tx

Synchronous Tx

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 14 / 57

Page 15: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Digital Data Transmission Techniques Synchronous Data Link Layer Protocols

Synchronous Data Link Layer Protocol

Byte-oriented protocols (framing technique: sentinel approach orbyte counting approach)

BISYNC: Binary Synchronous protocol by IBMPPP: Point-to-Point protocolDDCMP: Digital Data Communication Message protocol by DEC

Sentinel characters: STX (start of text) ETX (end of text), SOH(start of header), DLE (data link escape)Sentinel approach is also know as byte-stuffingByte count may be an issue

(BISYNC)

(DDCMP)

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 15 / 57

Page 16: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Digital Data Transmission Techniques Synchronous Data Link Layer Protocols

(Cont.)

Bit-oriented protocol - byte boundaries are not significant, frame iscollection bits. Used in Synchronous Data-Link Control protocol(SDLC) - by IBM, which was later standardized by ISO as HDLC(High-Level Data Link Control) protocolHDLC frames begins and ends with a distinguished bit sequence -01111110. it stuffing is used to replace this pattern in the data, if itexistsSender - except while transmitting distinguisged bit sequence -inserts ZERO after any 5 consequtive ONEs been transmittedReceiver - should 5 consequtive ONEs received

If next bit is ZERO =⇒ stuffed bit, so remove itIf next bit is ONE, then check the 7th bit, if it is ZERO =⇒end-of-frame, else =⇒ there must be an error and whole frame isdiscarded

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 16 / 57

Page 17: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Digital Data Transmission Techniques Synchronous Data Link Layer Protocols

Bit-stuffing Flow Chart

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 17 / 57

Page 18: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Digital Data Transmission Techniques Synchronous Data Link Layer Protocols

Fixed Length Framing

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 18 / 57

Page 19: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control

Error Control

Types of ErrorsSingle bit error

Multi bit errors

Bursty errors

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 19 / 57

Page 20: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control

(Cont.)

Error Control:Error detection and Retransmission of corrupted framesError correction

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 20 / 57

Page 21: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Detection

Vertical redundancy check - parity checkEven parity - add 0 at the end of byte, if number of ones are evenDetects all odd-number of bit errors

Longitudinal redundancy check (LRC)VRC + LRC (Two-dimensional redudancy check)Cyclic redundancy check (CRC)Checksum

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 21 / 57

Page 22: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Detection

VRC+LRC

(LRC)

(LRC+VRC)

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 22 / 57

Page 23: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Detection

(Cont.)

Detects - any number of errors in a single row (detect evennumber of errors with column parity)Detects - any number of errors in a single column (detect evennumber of errors with row parity)Detects all 1,2,3 bit errors, most 4 bit errors

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 23 / 57

Page 24: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Detection

CRC

VRC,LRC are addition based, CRC is division basedRedundancy overhead doesn’t depend on the size of dataUses modulo-2 divisionTransmitted frame = T of size n+k+1 bits, Message of order n (n+1bits), reminder k bits, so predetermined divisor of order k (k+1 bits)

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 24 / 57

Page 25: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Detection

CRC-Example

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 25 / 57

Page 26: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Detection

Modulo-2 arithmeticAny polynomial B(x) can be divided by a divisor polynomial C(x) ifB(x) is of higher degree than C(x). item Any polynomial B(x) can bedivided once by a divisor polynomial C(x) if B(x) is of the samedegree as C(x).The remainder obtained when B(x) is divided by C(x) is obtained bysubtracting C(x) from B(x).To subtract C(x) from B(x), we simply perform the exclusive-OR(XOR) operation on each pair of matching coefficients.

How CRC is computed?Multiply M(x) by xk ; that is, add k zeroes at the end of the message.Call this zero-extended message T(x).Divide T(x) by C(x) and find the remainder.Subtract the remainder from T(x).

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 26 / 57

Page 27: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Detection

How Good CRC is?

All single-bit errors, as long as the xk and x0 terms have nonzerocoefficients.All double-bit errors, as long as C(x) has a factor with at leastthree terms.Any odd number of errors, as long as C(x) contains the factor(x+1).Any burst error (i.e., sequence of consecutive errored bits) forwhich the length of the burst is less than k bits. (Most burst errorsof larger than k bits can also be detected.)

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 27 / 57

Page 28: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Detection

CRC Computing and Validating Procedures

Let us define:D = k -bit block of data or message (dividend); R = (n-k )-bit FCS; P =pattern of n-k+1 bits (divisor); T = n-bit frame to be transmitted;At Sender

Division operation (2n−k DP = Q + R

P ) yields remainder R,Now Transmitted frame is T = 2n−kD + R

At ReceiverDivide T

P = 2n−k D+RP = 2n−k D

P + RP = Q + R

P + RP = Q + R+R

P = QThere is no remainder, therefore T is exactly divisible by P.Note: Binary number added to itself (ex. R + R) yields 0 inmodulo-2 arithmetic.

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 28 / 57

Page 29: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Detection

Checksum

”One’s complement of one’s complement sum of all the words in themessage”

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 29 / 57

Page 30: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Detection

Adding TWO numbers in 1’s complement,0 + 0 = 0, 1 + 0 = 1, 0 + 1 = 1, 1 + 1 = 0 and carry is 1. If the lastcolumn generates carry, a 1 to the result.

PerformanceDetects all errors involving an odd number of bits, as well as mosterrors involving an even number of errorsSimilar to LRC, one or more bits in a segment are damaged and thecorresponding bit or bits of opposit value in a second segment arealso damaged, then the sum of those columns will not change andreceiver will not detect a problem.Checksum retains all carries, so if two 0s becoming 1s would notchange the value of their own column, they would change the valueof the next higher column.

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 30 / 57

Page 31: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Detection

Example

Message to be transmitted101010010011100111100010 (Sum)00011101 (Complement)

Message received10101001001110010001110111111111 (Sum)00000000 (Complement) means this pattern is OK

Check if message gets corrupted as10101111 (corrupted)11111001 (corrupted)00011101???????? (Sum)???????? (Complement) should be NON ZERO

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 31 / 57

Page 32: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Correction

Error Correction

Error recovery in Error-Detection requires block of data to beretransmittedBit error rate on wireless links can be quite high, soretransmissions may still be highRetransmissions still be costly in links with high propagationdelays

data

no er

ror o

rco

rrec

tabl

eer

ror

dete

ctab

le bu

t not

corr

ecta

ble e

rror

codeword

FECdecoder

k bits

data

codeword

FECencoder

n bits

Transmitter Receiver

Error Correction ProcessDr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 32 / 57

Page 33: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Error Control Error Correction

General Principles

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 33 / 57

Page 34: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control

Flow Control

Frame 1

Source Destination

Time

Frame 1

Frame 2

Frame 2Frame 3

Frame 3Frame 4

Frame 4

Frame 5

(a) Error-free transmission

Model of Frame Transmission

Frame 5

Frame 1

Source Destination

Frame 1

Frame 2

Frame 3

Frame 3Frame 4

Garbledframe

¥

Frame 5

(b) Transmission withlosses and errors

Frame 5

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 34 / 57

Page 35: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Stop and Wait

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 35 / 57

Page 36: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Stop and Wait

t0 T RT R

t0 + 1 T RT R

t0 + a T RT R

t0 + 1 + a T RT R

t0 + 1 + 2a ACK

Frame

t0

t0 + a

t0 + 1

t0 + 1 + a

t0 + 1 + 2a T RT R

(b) a > 1(a) a < 1

Stop-and-Wait Link Utilization (transmission time = 1; propagation time = a)

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 36 / 57

Page 37: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Sliding Window

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 37 / 57

Page 38: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Sliding Window

(Cont.)

F0

F1

F2

RR 3

F3

F4

F5

F6RR 4

Source System A Destination System B

Example of a Sliding-Window Protocol

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 38 / 57

Page 39: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Sliding Window

(Cont.)

Sliding-Window Depiction

0• • • 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 • • •

Window of framesthat may be transmittedFrames already transmitted

Frames buffereduntil acknowledged

Last frametransmitted

Last frameacknowledged

Framesequencenumber

Window shrinks fromtrailing edge asframes are sent

Window expandsfrom leading edgeas ACKs are received

(a) Sender's perspective

0• • • 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 • • •

Window of framesthat may be acceptedFrames already received

Last framereceived

Last frameacknowledged

Window shrinks fromtrailing edge asframes are received

Window expandsfrom leading edgeas ACKs are sent

(b) Receiver's perspective

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 39 / 57

Page 40: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Sliding Window

Utilization of Stop-and-Wait and Sliding Window

(a) W ³ 2a + 1

2a + 1

a + 1

a

2

1

t = 0

Frame (2a + 1)A BA Frame (2a) Frame (a+2) Frame (a+3)• • •

Frame (a + 1)A BA Frame a Frame 2• • •

Frame aA B Frame (a – 1) Frame 1 Frame 2

Frame 3

• • •

Frame 2A B Frame 1

Frame 1A B

A B

(b) W < 2a + 1

2a + 1

W

1

t = 0

A BA Frame (a + 2)• • •

Frame WA BA Frame (W – 1) Frame (W–a+1)

Frame W

• • • Frame (W-a+2)

a + 1 Frame (a + 1)A BA Frame a Frame 2• • • Frame 3

a Frame aA B Frame (a – 1) Frame 1 Frame 2• • •

Frame 1A B

A B

Timing of Sliding-Window Protocol

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 40 / 57

Page 41: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Sliding Window

(Cont.)

1.0

0.8

0.6

0.4

0.2

0.0

Utili

zatio

n

0 .1 1 1 0 1 0 0 1000

W = 7 W = 1

W = 127

Sliding-Window Utilization as a function of a

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 41 / 57

Page 42: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Automatic Repeat Requests (ARQs)

ARQs

frame 0

ACK1

frame 1

ACK0

frame 1

ACK 0

frame 0

ACK1

frame 1

PDU trans-mission time

ACK trans-mission time

Propagation time

Time-out interval

PDU 0 lost;A retransmits

Time-out interval

ACK0 lost;A retransmits

B discardsduplicate PDU

Stop-and-Wait ARQ

frame 0

ACK 0

Tim

e

A B

RR (P bit = 1)

RR 2

RR 4

REJ 4

RR 5

RR 1

frame 0

frame 1

frame 2

frame 3

frame 5frame 6

frame 4frame 5

frame 6frame 7

frame 0

frame 1

frame 2

frame 4

RR 7

(a) Go-back-N ARQ

4, 5, and 6retransmitted

discarded byreceiver

Timeout

RR (P bit = 1)

RR 2

RR 4

SREJ 4

RR 7

RR 3

frame 0

frame 1

frame 2

frame 3

frame 5frame 6

frame 4frame 7

frame 0frame 1

frame 2

frame 3

frame 4

frame 4

RR 1

(b) Selective-reject ARQ

4 retransmitted

buffered byreceiver

Timeout

Sliding-Window ARQ Protocols

A B A B

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 42 / 57

Page 43: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Automatic Repeat Requests (ARQs)

Stop & Wait Operations

At senderTransmits a frame (say F0) and wait for an Ack (RR1, i.e., ReceiverReady to Receive 1) or Timeout.If timeout, retransmit the same frame (F0).If proper Ack (RR1), transmit next frame (F1).If corrupted Ack, do nothing.

At receiverIf receives an error-free frame in sequence, say F0, send an AckRR1.If receives a corrupted frame, discard the frame and do nothing.

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 43 / 57

Page 44: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Automatic Repeat Requests (ARQs)

FSM

Idle Active

LLC Send

PollTimerON ?

YES/Buff Frame

NO/Tx Frame

AckAwaiting ?

LLC Send

PollTimerON ?

YES/Buff Frame

YES/Buff Frame

NO/Tx Frame

Timeoutfor Frame i

No.Timeouts for Frame i> MaxTries ?

YES

EmptyBuff ?

NO/Tx Frame i+1

NO/reTx Frame i

YESRR i+1

RNR i+1/Start PollTimer

PollTimeout/Tx RR with Poll=1

PollTimeout/Tx RR with Poll=1

Sender Side Operations in Stop & Wait ARQ

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 44 / 57

Page 45: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Automatic Repeat Requests (ARQs)

Sliding-window with Go-back-N Operations

At senderKeep transmitting the next frame from the Sliding Window.If Ack/cummulative Ack (RRx) is received, slid the window right bythe number frames Acked by this ack, and transmit the nextavailable frame in the window.If Timeout, send a command frame (called RR) with Poll bit P=1.If any error-free REJ x frame is received, retransmits frame withseq. num. x and also all subsequent frames, if window permits.If corrupted Ack/REJ is received, do nothing.

At receiverIf receives an error-free frame in sequence, then send anAck/cummulative Ack and free the window by those many framesthat were Acked.Discard any error-free out-of-order frame received, and for eachsuch frame send reject frame, REJ x , where x is the next frame insequence the receiver is expecting.If receives a corrupted frame, discard the frame and do nothing.

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 45 / 57

Page 46: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Automatic Repeat Requests (ARQs)

Sliding-window with Selective-Reject Operations

At senderSimilar to Go-back-N, but retransmits only the missing frame, x ,upon receiving REJ x .

At receiverSimilar to Go-back-N if an error-free in sequence frame is received.If out-of-order and error-free frame is received, buffer it and sendSelective REJ, SREJ x , where x is the sequence numer of themissing frame.If corrupted frame is received, do nothing .

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 46 / 57

Page 47: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Automatic Repeat Requests (ARQs)

Analysis of Error-free Stop & Wait and Sliding WindowFlow Control

Let a. ttx , b. tprop, c. tproc , be the transmission, propagation,propagation, processing times, resp, of a data frame.Let also d. ttxA and e. tprocA be the transmission and processingtimes, resp, of corresponding Ack frameThen Link Utilization, which is defined in terms of effective timethe link being used for transmitting a data packet (a) and total timeinvolved (a+b+c+d+e)Stop & wait utilization U = a

a+b+c+d+b+e . Ignoring c, d,e as theyare negligible, U = ttx

2tprop+ttx= 1

1+2a where a= tpropttx

.

For Sliding window utilization, W , which denotes window size,number of packets will be transmitted in the same amount of time(i.e., a + b + c + d + b + e), so its utilization U = W

1+2a

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 47 / 57

Page 48: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Automatic Repeat Requests (ARQs)

Analysis of Stop & Wait and Sliding Window ARQs

Let p be the probability of single frame being in errorStop & Wait ARQ = 1

(1+2a)Nr, where Nr is the expected number of

transmissions of a frame.Nr = E[transmissions] =

∑∞i=1 i × Pr [i transmissions] =∑∞

i=1(i × P i−1(1− P)) = 11−P .

Note∑∞

i=1(iXi−1) = 1

(1−X)2 where −1 < X < 1

Therefore Stop & Wait U = 1−P1+2a

Selectieve Reject:

U =

{(1− P) if W ≥ 1 + 2aW (1−P)

1+2a if W < 1 + 2a

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 48 / 57

Page 49: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Automatic Repeat Requests (ARQs)

Go-back-N ARQ Analysis

In Go-back-N, each error generates a requirement to retransmit Kframes rather than just one packet.So, Nr = E[number of transmitted frames to successfully transmitone frame] =

∑∞i=1(f (i)× P i−1(1− P)).

f (i) is total number of frames transmitted if the original frame istransmitted i times, which can be express as f (i) = 1 + (i - 1)K =(1 - K ) + Ki .Nr =

∑∞i=1((1− K ) + iK )× P i−1(1− P), simplifying this yields

1−P+KP1−P

Here K ≡ (1 + 2a) for W ≥ (1 + 2a), otherwise K = W ifW < (1 + 2a).Go-back-N:

U =

{(1−P)1+2aP if W ≥ 1 + 2a

W (1−P)(1+2a)(1−P+WP) if W < 1 + 2a

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 49 / 57

Page 50: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Automatic Repeat Requests (ARQs)

Utilization

1.0

0.8

0.6

0.4

0.2

0.0

Utili

zatio

n

0 .1 1 1 0 1 0 0 1000a

Stop-and-wait

W =127 Go-back-N

W =7 Go-back-N

ARQ Utilization as a Function of a (P = 10 –3)

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 50 / 57

Page 51: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control Automatic Repeat Requests (ARQs)

Sequence Numbers

If k bits are used for sequence numbers, in Go-back-N, maximumW = 2k − 1, and in Selective-Reject W = 2k−1.Why?.

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 51 / 57

Page 52: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control High-level Data Link Control Protocol

HDLC

HDLC bit-oriented protocol adopted as standard data link layer inOSI. It is derived from SDLC - Synchronous DLC of IBM.All bit-oriented protocols in use today, either derived from or aresource for HDLC. Example: LAP-B (Link Access Procedure -Balanced), LAP-D, LAP-M, Frame Relay, PPP, LLC.Types of stations defined:

Primary Station - this completely controls all data link operationsissuing commands from secondary stations and has the ability tohold separate sessions with different stations.Secondary Station - this can only send responses to one primarystation. Secondary stations only talk to each other via a Primarystation.Combined Station - this can transmit and receive commands andresponses from one other station.

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 52 / 57

Page 53: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control High-level Data Link Control Protocol

Link Configurations

Configuring a channel for use by a station can be done in one ofthree ways:

Unbalanced - this configuration allows one primary station to talk toa number of secondary stations over half-duplex, full-duplex,switched, unswitched, point-to-point or multipoint links.Balanced - where two combined stations communicate over apoint-to-point or multi-point links which can be full/half-duplex orswitch/unswitched.

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 53 / 57

Page 54: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control High-level Data Link Control Protocol

Modes of Communication

When transferring data, stations are in one of three modes:Normal Response Mode (NRM) where the secondary station needspermission from the primary station before it can transmit data.Mainly used on multi-point lines.Asynchronous Response Mode (ARM) where the secondary stationcan send data without receiving permission from the primarystation. This is hardly ever used.Asynchronous Balanced Mode (ABM) where either station caninitiate transmission without permission from the other. This is themost common mode used on point-to-point links.

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 54 / 57

Page 55: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control High-level Data Link Control Protocol

Frame Types

Information Frames (I-frame) are used for the data transferbetween stations. The send sequence, or next send N(S), and thereceive sequence, or next receive N(R), hold the frame sequencenumbers. The Poll/Final bit is called Poll when used by theprimary station to obtain a response from a secondary station,and Final when used by the secondary station to indicate aresponse or the end of transmission.Supervisory Frames (S-frame) are used to acknowledge frames,request for retransmissions or to ask for suspension oftransmission. The Supervisory code denotes the type ofsupervisory frame being sent.Unnumbered Frames (U-frame) are used for link initialisation orlink disconnection. The Unnumbered bits indicate the type ofUnnumbered frame being used.

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 55 / 57

Page 56: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control High-level Data Link Control Protocol

(Cont.)

FlagFCSInformationControlAddressFlag

8bits

8extendable

8 or 16 variable 16 or 32 8

(a) Frame format

I: Information

S: Supervisory

U: Unnumbered

1 2 3 4 5 6 7 8N(R)

N(R)

M

N(S)

S

M

0

0

1

1 1

P/F

P/F

P/F

N(S) = Send sequence numberN(R) = Receive sequence numberS = Supervisory function bitsM = Unnumbered function bitsP/F = Poll/final bit

(c) 8-bit control field format

Information 0 N(S) P/F N(R)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Supervisory 1 P/F N(R)0 S 0 0 0 0

(d) 16-bit control field format

HDLC Frame Structure

01 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 8n

0 1• • •

(b) Extended Address Field

Flag - value - 01111110 in binaryDr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 56 / 57

Page 57: Physical and Data-Link Layershome.iitj.ac.in/~ramana/phy_dll.pdf · Physical and Data-Link Layers Dr. Ramana ... B =Valid bipolar signal V = Bipolar violation (odd numberof 1s

Flow Control High-level Data Link Control Protocol

(Cont.)

A BI, 0, 0

I, 1, 1I, 2, 1

I, 3, 2

RR, 4

I, 0, 1

I, 1, 3

I, 3, 4I, 2, 4

(b) Two-way data exchange

A B

RNR, 4

RNR, 4, F

RR, 4, F

I, 3, 0

RR, 0, P

I, 4, 0

RR, 0, P

(c) Busy condition

A BI, 3, 0

I, 4, 0

I, 5, 0

I, 4, 0

I, 6, 0

I, 5, 0

REJ, 4

(d) Reject recovery

A BI, 2, 0

RR, 0, P

I, 3, 0

RR, 3

RR, 4

RR, 3, F

(e) Timeout recovery

Time-out

A BSABM

SABM

UA

DISC

UA

(a) Link setup and disconnect

•••

I, 3, 0

Time-out

Figure 7.9 Examples of HDLC Operation

N(S) N(R)

Dr. Ramana ( I.I.T Rajasthan ) Physical and Data-Link Layers 57 / 57