topics in networking1 data link layer services and protocols arzad a. kherani ([email protected])...

91
Topics in Networking 1 Data Link Layer Data Link Layer Services and Protocols Services and Protocols Arzad A. Kherani ([email protected]) Dept. of Computer Sc. And Engg. Indian Institute of Technology Delhi

Upload: myrtle-lloyd

Post on 11-Jan-2016

220 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 1

Data Link Layer Services and Data Link Layer Services and ProtocolsProtocols

Arzad A. Kherani([email protected])

Dept. of Computer Sc. And Engg.

Indian Institute of Technology Delhi

Page 2: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 2

OutlineOutline

Frame encoding Error detection and recovery Data Link Protocols Protocol analysis

– Performance– Verification for correctness

Page 3: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 3

Data link servicesData link services Operates between two neighboring devices Provides a capability for higher-layer entities to send “packets”

– A packet is a sequence of bits, with well-identified “start” and “end” The packet is itself encapsulated into a “frame”, adding to it

“header” and “trailer”

Page 4: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 4

Data link services (2)Data link services (2)

Network layer

Data link layer

Physical layer Data link protocol

Service boundary

Page 5: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 5

Data link services (3)Data link services (3)

There is one data link for each physical link In a router, for instance:

Page 6: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 6

Data link servicesData link services

Connection-less service– Un-acknowledged service

Useful in case of low errors, and for real-time applications

– Acknowledged service Used in wire-less networks Frames that are not acked may be re-sent

Connection-oriented service– acknowledged

Ensures delivery of frames

Page 7: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 7

FramingFraming

Link  layer  packet  =  frame Problem:  how  to  recognize  beginning 

and  end  of  frame? Three  methods

– byte  counting  (DDCMP)– bit  stuffing  (X.25  Level  2,  802.x)– byte  stuffing  (BISYNCH,  IMP-IMP)

Page 8: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 8

FramingFraming

Solution based on counting bits/characters

Page 9: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 9

FramingFraming

Solution based on flags (01111110) and bit stuffing

Original bit string

Bit string, suitably bit-stuffed

Received, interpreted bit string

Page 10: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 10

Bit Stuffing (2)Bit Stuffing (2)

Frame  beginning  and  end  marked  by  special 

bit  string  ( 01111110) If    5  1's  in  data  to  be  sent,  sender  inserts  0 If  receiver  sees  5  1's  check  next  bit(s)

– if  0,  remove  it  (stuffed  bit)– if  10,  end  of  frame  marker  (01111110)– if  11,  error  (7  1's  cannot  be  in  data)

Page 11: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 11

FramingFraming Solution based on flag characters, byte stuffing

Special  characters  used  for  control

Page 12: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 12

Byte Stuffing ProblemsByte Stuffing Problems

Dependence  on  fixed  character  set

Must  examine  every  byte  of  data  on  sending 

and  receiving  (insert  /  remove  DLE)

Was  used  widely  in  IBM  bisynch  (at  9600bps)

Page 13: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 13

Error detection and recoveryError detection and recovery

Two approaches:– error correction codes

quick, but ineffective in several cases:– temporary dislocation

– frame size is large, and error rate is high

– burst errors expensive

– error detection and recovery using re-transmission the preferred solution today

– efficient

Page 14: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 14

Error detectionError detection

Hamming distance between pair of codeslet message of length m 2m distinct messages

with r redundant bits, codeword is of length n = m + r

hamming distance between codes x, y

= no. of bits in which x and y differ

Hamming distance for a codeconsider n dimension space, with 2m codewords

hamming distance for code (or coding scheme)

= minx, y (no. of bits in which x and y differ)

Page 15: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 15

Hamming codesHamming codes

Hamming distance for code based on parity bit is 2 resulting capability: detect 1 error, correct 0 errors Result:

– to detect d errors, the Hamming distance must be d+1– to correct d errors, the Hamming distance must be at least

2d +1

dd

Page 16: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 16

Hamming codes (2)Hamming codes (2) Consider 7 bit data, 4 redundancy bits, codeword is 11 bits message bits are numbered 3, 5, 6, 7, 9, 10, 11 redundancy bits are numbered 1, 2, 4, 8

check bit 1 checks error in bits 1, 3, 5, 7, 9, 11

check bit 2 checks error in bits 2, 3, 6, 7, 10, 11

check bit 4 checks error in bits 4, 5, 6, 7

check bit 8 checks error in bits 8, 9, 10, 11

or (it should be)

0 = b1 + b3 + b5 + b7 + b9 + b11

0 = b2 + b3 + b6 + b7 + b10 + b11

0 = b4 + b5 + b6 + b7

0 = b8 + b9 + b10 + b11

Page 17: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 17

Error detection using block codesError detection using block codes Block of data is re-written as a matrix, say 4 x 8 last row is parity bits bits are transmitted row-by-row, including parity bits code is capable of detecting a burst of errors of length n

column --> 1 2 3 4 5 6 7 8

row 1 1 0 1 1 0 0 1 1

row 2 0 0 1 0 0 0 1 0

row 3 1 1 1 0 0 1 1 0

row 4 1 1 0 0 1 1 0 0

parity bits 1 0 1 1 1 0 1 1

Page 18: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 18

Polynomial codesPolynomial codes Also known as Cyclic Redundancy Codes (CRC) Note, all arithmetic is modulo-2

x XrM(x) Xr M(x) /G(x) R(x)- T(x) = Xr M(x)-R(x)

R(x) = T(x) + E(x)

/G(x)=Yes no error

No error

0

Page 19: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 19

Polynomial codes (2)Polynomial codes (2) Error detection capability depends upon G(x) 1 bit error R(x) = T(x) + xi

R(x)/G(x) = 0 iff E(x)/G(x) = 0

E(x)/G(x) 0 if G(x) has 2 or more terms

single errors can always be detected Similarly, two errors can always be detected if G(x) does not

divide xk + 1 Again, if G(x) is divisible by x+1 then an odd number of errors

can be detected Polynomial codes with r CRC bits will detect all bursts of length r

or less etc., etc.

Page 20: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 20

Polynomial codes (3)Polynomial codes (3)

International, IEEE standards IEEE 802 standard

G(x) = x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x1 + 1

it is capable of detecting bursts of length up to 32, and all odd number of errors, and even no of error with high probability

Page 21: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 21

Error recoveryError recovery

Error detection, followed by re-transmissions, etc.

Efficient Simultaneously address problem of “flow

control”

Page 22: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 22

Elementary data link protocolsElementary data link protocols

Broad objective of data link protocol:– Error-free, loss-free, duplication-free and in-sequence

transfer of user data packets between network entities– flow-controlled– transfer user data packets in both directions

Network entity

Data link entity

Physical layer

Network entity

Data link entity

p1, p2, p3, .. p1, p2, p3, ..

Page 23: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 23

Data link modulesData link modules

Network entity Network entity

Data link entity

sender

receiver sender

receiverData link

entity

Physical layer entity

Physical layer entity

Full-duplex channel

Page 24: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 24

Data link modulesData link modules We consider several protocols. But to begin with we consider

moving data in one direction, only

Network entity Network entity

Data link entity

sender receiverData link

entity

Physical layer entity

Physical layer entity

HALF-duplex channel

Page 25: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 25

Data link protocolData link protocol

Assumptions:– errors during transmission– processing capacity at receiver end– buffer capacity at receiver end– whether the underlying physical channel is half- or

full-duplex

we will make nice assumptions to begin with, but move towards realistic assumptions later

Page 26: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 26

Simple data link protocol: UtopiaSimple data link protocol: Utopia Assume no errors, infinite processing capacity and buffer space

at receiver end, and half-duplex channel

Note, F_i: Data link frame, containing data packet, i

Sender, A Receiver, B

F_1

F_2

F_3

F_4

Page 27: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 27

Simple data link protocol: Utopia (2)Simple data link protocol: Utopia (2) The sender’s end

Page 28: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 28

Simple data link protocol: Utopia (3)Simple data link protocol: Utopia (3) The receiver’s end

Page 29: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 29

Definitions of data types/structuresDefinitions of data types/structures

Page 30: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 30

Definition of proceduresDefinition of procedures

Page 31: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 31

Simple data link protocol: Utopia (4)Simple data link protocol: Utopia (4)Network entity

Physical layer

Network entity

Page 32: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 32

Flow control: problem and its solutionFlow control: problem and its solution

Flow control --> limit the rate at which a sender can send data to one which is consistent with the receiver’s ability to process incoming data

Two approaches to solving it:– rate-based: determine the minimum rate at which receiver can

process incoming data

– feedback based: send more data as when receiver can handle more data

time

Rate rcvr can handle

Acceptable rate

Page 33: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 33

Stop and wait protocolStop and wait protocol

? Assume no errors, FINITE processing capacity, FINITE buffer space at receiver end, and half-duplex channel

Note, F_i: Data link frame, containing data packet, i

Sender, A Receiver, B

F_1

F_2

F_3

ack

ack

ack

Page 34: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 34

Stop-n-wait protocol (2)Stop-n-wait protocol (2)

Physical layer

Network entity Network entity

Page 35: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 35

PAR protocol for noisy channelsPAR protocol for noisy channels

PAR protocol addresses:– flow control– noisy channel

based on “positive acks” and re-transmissions

Page 36: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 36

PAR protocolPAR protocol

Sender, A Receiver, B

F_1

F_2

F_3

ack

ack

ack

Timer runs out

Timer runs out

F_2

F_3

ack

Page 37: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 37

PAR protocolPAR protocol

Sender, A Receiver, B

F_0

F_1

F_0

ack

ack

ack

Timer runs out

Timer runs out

F_1

F_0

ack

Data Frames are suitably numbered 0, 1, 0, 1, … Acks are not numbered

Page 38: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 38

PAR protocol (sender)PAR protocol (sender)

Page 39: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 39

PAR protocol (receiver)PAR protocol (receiver)

Page 40: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 40

PAR protocolPAR protocol

Physical layer

Network entity Network entity

Page 41: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 41

PAR protocolPAR protocol If the underlying physical layer is full-duplex, then the protocol fails

Sender, A Receiver, B

F_0

F_1

F_0

ack

ack

ack

Timer runs out

F_1

F_0

ack

Pkt 1

Pkt 2

Pkt 3

Pkt 4

Pkt 1

Pkt 4

Page 42: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 42

Alternating bit protocolAlternating bit protocol PAR protocol, with numbered acks

Sender, A Receiver, B

F_0

F_1

F_0

Ack_0

Ack_1

Ack_0

Timer runs out

Timer runs out

F_1

F_0

Ack_0

Pkt 1

Pkt 2

Pkt 3

Pkt 1

Pkt 2

Pkt 3

Page 43: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 43

Alternating bit protocolAlternating bit protocol

Page 44: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 44

Alternating bit protocolAlternating bit protocol

Page 45: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 45

Alternating bit protocolAlternating bit protocol Two possibilities:

Page 46: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 46

Alternating bit protocolAlternating bit protocol Use link A B to carry data from A to B, and acks from B to A

and use link B A to carry data from B to A, and acks from A to B

Piggyback acks onto data frames, if one has data to send Else, just an ack Redundant acks are OK An ack takes the form “I am waiting to receive data frame no. X” Introduce a field for frame type, “data frame” or “ack frame”

Page 47: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 47

Performance of PAR protocolPerformance of PAR protocol Link utilization

Utilization = L / (L+b*R), where

L = size of data frame

b = data rate

R is round-trip delay For a satellite channel, let L = 10K bits, b = 100 Kbps, R=500ms

Utilization is 10K / (10K + 50K) = 1/6 For a fibre-optic channel, let L = 10K bits, b = 100 Mbps, R = 1ms

Utilization is 10K / (10K + 100K) = 1/11

Delay=BW product is the key Let sender send many data frames before it receives an ack

Page 48: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 48

PipeliningPipelining

Problems arise when one or more packets are lost

Page 49: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 49

Pipelining, with error recoveryPipelining, with error recovery Two approaches to recover from loss of data frame:

– go-back n– selective repeat

Page 50: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 50

Pipelining, with error recoveryPipelining, with error recovery Go-back n scheme:

Page 51: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 51

Pipelining, with error recoveryPipelining, with error recovery Selective repeat

Page 52: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 52

Sliding window protocolsSliding window protocols

Each data frame is sequentially numbered 0 through 2n-1

Sender maintains “transmit window” indicating:– which data frames can be sent– which data frames have been sent

receiver maintains a “Receive window”– which data frames can it receive– which data frames have been received

Page 53: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 53

Sliding window protocolsSliding window protocols Transmit window:

– size = 4, waiting for acks for data frames 1, 2, 3, frame 4 not sent

Receive window:– size = 3, ack for frame 1 sent, data frame 3 received, waiting for

frames 2 and 4

0 1 2 4 53 76

0 1 2 4 53 76

Page 54: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 54

Sliding window protocolsSliding window protocols

Assuming sequence numbering 0 .. 7– Go back n protocol:

Transmit window is size, say 7 receive window is size 1

– selective repeat protocol: transmit window is size 4 receive window is size 4

Page 55: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 55

Go back n protocol: declarationsGo back n protocol: declarations

Page 56: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 56

Go back n protocol: more declrationsGo back n protocol: more declrations

Page 57: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 57

Go back n protocol: initializationsGo back n protocol: initializations

Page 58: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 58

Go back n protocol (loop)Go back n protocol (loop)

Page 59: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 59

Go back n protocol: event processingGo back n protocol: event processing

Page 60: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 60

Go back n protocol: event processingGo back n protocol: event processing

Page 61: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 61

Go back n protocol: event processingGo back n protocol: event processing

Page 62: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 62

Go back n protocolGo back n protocol

Buffer requirements– at sender’s end: N-1, where seq no is 0 .. N-1– at receiver’s end: 1

Go-back n works well when error are infrequent– Because several frames need to be re-transmitted

when an error occurs

Page 63: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 63

Select Repeat ProtocolSelect Repeat Protocol

Sequence numbering: 0 through n-1 Transmit window size is n/2 Receive window size is n/2

Receiver buffers each correctly recd data frame, but does not deliver it to the layer 3

Receiver sends a NACK frame when it suspects loss of a data frame– But makes sure that a NACK is not repeated

Page 64: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 64

Select Repeat ProtocolSelect Repeat Protocol

Page 65: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 65

Select Repeat ProtocolSelect Repeat Protocol

Page 66: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 66

Select Repeat ProtocolSelect Repeat Protocol

Page 67: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 67

Select Repeat ProtocolSelect Repeat Protocol

Page 68: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 68

Protocol AnalysisProtocol Analysis

Performance Verification

Page 69: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 69

Protocol PerformanceProtocol Performance

Performance– Delay– Efficient use of available bandwidth

Page 70: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 70

Channel utilizationChannel utilization It can be shown for “stop-and-wait” protocol:

U = F1 * F2 * F3where

F1 = D/ (H+D)F2 = (1-E)(H+D) * (1-E)D F3 = (H+D) / (H+D+CT)

Above,D, H are resp. length of data and header (or Ack)E is bit-error-rate (BER)C is channel capacityT is timer interval

Page 71: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 71

Channel utilizationChannel utilization

Channel utilization in “stop-and-wait” protocol is maximum when

Doptimum = (H+CT)/E

Page 72: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 72

Channel utilizationChannel utilization

Channel utilization in “sliding-window” protocols is complex. Consider:– No error, large Tx window– No error, small Tx window– With possibility of errors, large Tx window– With possibility of errors, small Tx window

Page 73: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 73

Channel utilizationChannel utilization

What is a large enough window size?

W > 1 + 2 C I / (D+H)where I = propagation delay + interrupt handling time

Page 74: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 74

Channel utilizationChannel utilization

Channel utilization in “sliding-window” when there is no error, large Tx window

U = D / (D+H)

Channel utilization in “sliding-window” when there is no error, but small Tx window

U = D/(D+H) * W/(1 + 2 C I / (D+H))

Page 75: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 75

Channel utilizationChannel utilization

Channel utilization in “sliding-window” when there may be errors, but Tx window is small U = D/(D+H) * (1-L)

where L is the probability that a frame or an ack to it is lost

Channel utilization in “sliding-window” when there may be errors, but Tx window is small U = D/(D+H) * (1-L) * W/(1 + 2 C I / (D+H))

Page 76: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 76

Channel utilizationChannel utilization

C*I is also the “delay-BW product”, And CI/F is the delay-BW product in terms of

no of frames

Window size

Channel util. Increasing delay-BW

prod.

Page 77: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 77

Protocol VerificationProtocol Verification

Verification– Formal specification– Verification of protocol design– Conformance of an implementation to a given

design

Page 78: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 78

Protocol VerificationProtocol Verification

Two parts:– protocol modeling– verification

Look upon the communicating entities as ONE finite state machine

Use two different, although equivalent, ways to model the machines:– State transition diagrams– Petrinet based model

Page 79: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 79

Protocol verification: model using state Protocol verification: model using state transitionstransitions

Consider an example: stop-n-wait protocol– Consider the sender-receiver pair, together with

channels as ONE single system– Focus on significant states, not intermediate states

encountered while executing commands or program instructions

Page 80: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 80

Protocol Verification: model using Protocol Verification: model using state transitionsstate transitions

Stop-n-wait protocol components, and their states– Sender: “sending” 0 or 1– Receiver: receiving 0 or 1– Half-duplex channel: carrying frame 0 or 1, or Ack, or “-”– Acks are not numbered

Total no of states is 16, of which 6 are unreachable– These are states that correspond to sender and receiver waiting for

next event to occur Further,

– Consider initial state– Any enabled transition may take place next– Transitions take place at any time

Page 81: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 81

Protocol Verification: model using Protocol Verification: model using state transitionsstate transitions

Page 82: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 82

Protocol VerificationProtocol Verification

Can a protocol drop a user packet?– Protocol never delivers packets in two data

frames, numbered 0, without delivering packet contained in a data frame numbered 1

– Or, machine does not make two transitions numbered “1”, without an intervening transition “3”

– There does not a path with two edges corresponding to “transition 1” without an intervening edge “transition 3”

Page 83: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 83

Protocol VerificationProtocol Verification

Can a protocol drop a sequence of two user packets?– Or, sender should not state 1 twice while receiver

does not change its state in between

Page 84: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 84

Protocol modeling using PetrinetsProtocol modeling using Petrinets

A Petrinet, with– places: set of possible states– tokens: define the current state– transitions, input and output arcs– firing of transitions:

conditions, and resulting re-distribution of tokens

eating

sleeping

wake-upburp

eating

sleeping

wake-upburp

Page 85: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 85

Producer/consumer modelProducer/consumer model

producing

waiting1

done1

consuming

waiting2

done2

Model of a producer- consumer system with one buffer, using Petrinet

Page 86: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 86

Stop-n-wait Stop-n-wait protocol modelprotocol model

Page 87: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 87

Stop-n-wait Stop-n-wait protocol modelprotocol model

Petrinet is formally described by its transitions:1: BD --> AC

2: A --> A

3: AD --> BE

4: B --> B

5: C -->

6: D -->

7: E -->

8: CF --> DF

9: EG --> DG

10: CG --> DF

11: EF --> DG

Page 88: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 88

Stop-n-wait Stop-n-wait protocol modelprotocol model

Using the formal specs one can formally argue about properties that are (are not) satisfied:

– e.g. consider all possible sequences of transitions. Then are there two “10” transitions without an intervening transition “11”?

– How would ensure that two consecutive packets are not lost

Page 89: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 89

Example Data Link ProtocolsExample Data Link Protocols

HDLC (bit-oriented, high-level data link control)– Connection establishment, release, data transfer, and even connection reset

Page 90: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 90

Example Data Link ProtocolsExample Data Link Protocols PPP (point-to-point protocol)

– Mainly used router-to-router and dial-up connections– Connection establishment and release a data link, data transfer, and even connection reset– Help establish network layer (IP) addresses

Over LANs, the protocol is typically Ethernet

Page 91: Topics in Networking1 Data Link Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of

Topics in Networking 91

ThanksThanks