chapter 2 point-to-point protocols and links. section 2.1 introduction

148
Chapter 2 Point-to-Point Protocols and Links

Upload: stephanie-norris

Post on 20-Jan-2016

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Chapter 2

Point-to-Point Protocols and Links

Page 2: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Section 2.1

Introduction

Page 3: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.1 Introduction Physical communication links Data link control

i.e. point-to-point protocols Physical links : requires background in

Linear system theory Random process Modern communication theory

Recall Chapter 1 section 1.3.1 page 34

Page 4: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Introduction

Page 5: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Introduction Our major problem in DLC : correct

bit error Error detection & correction ARQ ( Automatic Repeat request) Header + packet + trailer => frame

Page 6: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Section 2.2

Physical layerChannels & modems

Page 7: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.2 Physical layer:channels & modems

Skip,will be discussed if necessary

Page 8: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Section 2.3

Error Detection

Page 9: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.3 Error Detection DLC layer is to provide error-free

packets to next layer up

errorsdetect toappended bemust bit Extra

packets possible 2 bits ofpacket k K

Page 10: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.3.1 Single Parity checks Parity checks bit is the sum,

modulo 2 , of the bits in the original bit string Total number of 1`s in an encoded

string is always even Detect single bit error only.And , odd

number of bit errors

Page 11: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.3.2 Horizontal & Vertical Parity Checks

Page 12: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Horizontal & Vertical Parity Checks

Common use for ASCII encoded characters

Cannot detect four errors confined to 2 rows and 2 columns

Page 13: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.3.3 Parity Check Codes

length of wordcode tomapstring data possible2

checksparity : ; string data oflength :

wordcode

LK

L K

L K

k

Page 14: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Parity Check Codes Effectiveness of a code for error

detection1. Minimum distance of the code

• Single parity check is 2• Horizontal & Vertical is 4

2. Burst-detecting capability• Single parity is 1• Horizontal & Vertical is 1+length of row

3. Probability that a completely random string will be accepted as error-free

Page 15: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction
Page 16: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Parity Check Codes E.g.

Minimum distance Single parity check is 2 Horizontal & Vertical is 4

Burst-detecting Single parity check is 1 Horizontal & Vertical is 1 + length of row

Page 17: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Parity Check Codes

2correct distance Minimum

2errer undetected

an of prob. words,code 2

2 prob.with

received is stringeach

d/d

LK

-L

K

-K-L

Page 18: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Figure 2.15

Page 19: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.3.4 Cyclic Redundancy Checks(CRC)

01

101

1

011

1

011

02

21

1

0121

CDCDSD SX(D)

C(D) S(D)D X(D) nsmitted entire tra

CDCD CC(D)

,),CC,CRC(C

SDSD SS(D)

),S,S,,S(Sdata bits

LL

Lk-Lk-

L

LL-

L

kk-

kk-

k-k-

Page 20: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Cyclic Redundancy Checks(CRC)

2 modulo Remainder)(

1

polynomialgenerator a of in terms defined

offunction a is

11

1

g(D)

S(D)DDC

DgDgDg(D)

g(D)

S(D)C(D)

L

LL

L

Page 21: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Cyclic Redundancy Checks(CRC)

Remainder

1

2

34

234

245

2

3523

DD

DDD

DDD

DDD

DDDDDD

L=3S(D)=D2+1

Page 22: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Cyclic Redundancy Checks(CRC)

codewords are by divisible spolynomial all

by divisible are codewords all

quotient beLet

g(D)

g(D)

g(D)Z(D)C(D)S(D)DX(D)

C(D)g(D)Z(D)S(D)D

g(D)

S(D)D Z(D)

L

L

L

Page 23: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Cyclic Redundancy Checks(CRC)

codeword some itself is

e(D) ifonly errorsdetect tofailBut,

0e(D)then errors, no If

g(D)

e(D)Remainder

g(D)

y(D)Remainder

2) (mod e(D)X(D)y(D)occur,error If

received be y(D)ed transmittis X(D)Let

Page 24: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Cyclic Redundancy Checks(CRC)

detectable are errors single all

D equaln`t g(D)Z(D)ca

1)& terms(D2least at has g(D)

)(,1esay

:error single If)1(

L

i

i

iDDe

Page 25: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Cyclic Redundancy Checks(CRC)

1least at is errors of

enough burst , codeword a is if

least at by differ in terms

order-lowest&orderhighest

L

e(D)

Lg(D)Z(D)

Page 26: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Cyclic Redundancy Checks(CRC)

g(D)

De(D)

g(D)D

jiDDDDDe

i-j

j

jijji

by divisible is

1 if detected be tofails so,

by divisiblenot is

),1()(say

:occurserror double a If)2(

Page 27: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Cyclic Redundancy Checks(CRC)

detected! are errors double all

divisiblenot 112length fram If

12 s,polynomial primitive If

12n larger tha no becan n smallest

by divisilbe is 1

fields finite of theory From

,D

n

g(D)D

jiL

L

L

n

Page 28: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Cyclic Redundancy Checks(CRC)

-L

L

L

)(D L-

g(D)

2 errorsdetect tofailing of prob.

least at of capability detecting-burst

4least at distance minimum

12length bolck ,1 times1 degree of

polynomial primitive a ofproduct

: practiceIn

Page 29: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Cyclic Redundancy Checks(CRC)

1

1

161

1

245781011

121622232632

51216

121516

D

DDDDDD D

DDDDD Dg(D)

CCITT for CRC-DD Dg(D)

for CRC-DD Dg(D)

e.g.

Page 30: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Section 2.4

ARQ: Retransmission Strategies

Page 31: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.4 ARQ:Retransmission Strategies

2 aspects of retx algorithms or protocols

1. Succeed in releasing each packet,one oad only once without errors

2. Efficiency releasing unnecessary waiting & unnecessary retx

Page 32: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

ARQ:Retransmission Strategies

We assume , all frames containing transmission errors are detected Delay is arbitrary Frame may be “lost” & never arrive Frames arrive in the same order as

transmitted

Page 33: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

ARQ:Retransmission Strategies

Page 34: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.4.1 Stop-and-wait ARQ Each packet has been received correctly

before initiating tx of next packet If

Error free Acknowledge , Ack

Error frame Negative acknowledgement , NAK

Ack & NAK is protect with a CRC Ack lost or NAK

Resend the old packet

Page 35: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ

Page 36: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ

Page 37: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ Avoid this problem,returns the

number of next packet awaited Piggyback

Page 38: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ

Page 39: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Fig 2.21

Page 40: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ The algorithm for A to B

At node A1. SN02. Assign SN to the new packet3. Tx SN-th frame4. If receive from B with B

RN>SN,SNRN,go to Step2If no received frame from B,timeout , go to Step 3

Page 41: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ Continued

At node B1. RN0,repeat step2 &3 forever2. If error-free frame received with

SN==RN,RN++3. Within bounded delay after receiving

error-free frame send a frame to A containing RN

Page 42: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ Correctness of stop-and-wait

An algorithm is safe if it never produces an incorrect result

An algorithm is live if it can continue forever to produce results

Safety Initially, node B awaiting packet 0 , and only

packet 0 is released.Subsequently,node B has released all packets in order,up to , but not including ,packet RN

Page 43: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ

Page 44: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ

delay finite with ed transmittispacket each

repeatedlyargument thisusingby liveness,

finite is and show willWe

happennever events above theif Let

1 toincreased isA at :

B nodeat freeerror received is ipacket :

at time packet transmit tostartsfirst :

3321

32

3

2

11

i.e.

tttt

,tt

iSNt

t

tit

Page 45: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ

3232

111

1

1

11

timebefore ttedbeen traminever packet

any timefor

:

tti),SN(ti)RN(t

i)RN(t)SN(ti)SN(t

i)RN(t

ti

tRN(t)SN(t)

proof

Page 46: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ

finite is to argument, same

finite is

orrurs eventuallyreception freeerror

intervals finite

in occur withretx and ,correctly received is

tx -reeach that 0 prob. a that Assume

32

2

tt

t

q

Page 47: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ One trouble with Stop-and-wait

SN become arbitrarily large with increasing time

Given our assumption that frames travel in order on the link,SN modulus 2 is sufficient!

1packet received

, 1for waitingis B , After

1 , to From

2

31

i or i

it

i or ii , RN(t)SN(t)tt

Page 48: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Stop-and-wait ARQ

Page 49: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.4.2 Go Back n ARQ Several successive packets can be

sent without waiting for the next packet to be requested

Accept packets only in the correct order , and send RN back

RN is to acknowledge all packets prior to RN and to request packet RN

Page 50: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ

n

n-ii

n

size window"" sliding

ACKed) is i (before1 to from i.e.

packet newfor request a of absencein sent becan

packets successivemany how determine 1

Page 51: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ

Page 52: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ

Page 53: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ

Page 54: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ

Page 55: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ Go back n algorithm

At node A1. SNmin 0,SNmax0 (SNmin to SNmax-1)2. Do steps 3,4,5 repeatedly in any order3. If SNmax<SNmin+n and a packet is available,assign

SNmax to it & increment SNmax4. If an error-free frame is received from B containing

RN>SNmin,increase SNmin to RN5. If SNmin<SNmax,and no frame is currently in

transmission,choose some number SN,SNmin <=SN<SNmax;transmit SN-th frame. At most a bounded delay is allowed between successive transmission of packet SNmin over intervals when SNmin does not change

Page 56: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ Go back n algorithm

At node B RN0,repeat steps 2&3 forever When an error-free frame is received

from A containing SN==RN,increment RN At arbitrary times,but within bounded

delay after receiving any error-free data frame from A,transmit a frame to A containing RN

Page 57: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ Safety

Same as stop-and-wait Liveness

t1<t3 ,t2<t3

Page 58: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ

Page 59: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ

32min3

22

min

1tt

i (t) beyond SN at t

i) , RN(tat t

RN(t)(t)SN

Page 60: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ t2 could be <t1(why? P.77) It t1<t2 ,then RN(t)=i for t1 t t2

packet i after t1 will be accepted and since t2<t3 , node A will retx packet i until this happenedt1 to t2 is finite

No matter t1<t2 or t1>t2 Node B transmit frames carrying RN i+1 from time t2 until t3 since g>0, t2 to t3 is finitelive!

Page 61: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ with modulo m>n

Page 62: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ with modulo m>n

n)(tSNRN)(tSN

RN

RNSN

n)-SNRN(t

n)(tSN)RN(t)(tSN

n)(tSNSN)(tSN

2min2min

2

1min21min

1min1min

A,at

increment at packet received

release m mod receive B,at

1

Page 63: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Go Back n ARQ with modulo m>n

Page 64: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.4.3 Selective Repeat ARQ

Even if unnecessary retx are avoided,go back n protocol must re-tx at least one round-trip-delay when a single error occurs in an awaited packet

Idea of selective repeat ARQ is to accept out -of-order packet,and to request retx from A only for those packets that are not correctly received

Page 65: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Selective Repeat ARQ RN: lowest number packet not yet

correctly received N: window size Let p is probability of frame

error,the expected number of packets delivered to B per frame 1-p throughput of ideal

selective repeat

Page 66: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Ideal go back n ARQ r = ( 1-p ) + p( 1 + + )

r : 平均等? Frames 可等到 next awaited frame

( 1-p ) : 下一個成功 p : 失敗

)1

(

1

1

1

1

p

p

p

pr

Page 67: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Selective Repeat ARQ modulo m2n

B accept RN~RN+n-1 Feedback also contains which

packets beyond RN have been correctly received

Accepted out -of-order packets are saved until earlier packets are accepted & released

Page 68: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Selective Repeat ARQ modulo m2n

t1 : frame was first generated at node A at time t1

t2 : frame is received at node B

RN(t2)-nSNRN(t2)+n-1 If mod m ,and if packets are accepted in

the range RN(t2)~RN(t2)+n-1 it is necessary for B to distinguish

values of SN in the entire rangem2n

Page 69: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.4.4 ARPANET ARQ Using 8 stop-and-wait strategies in

parallel Each incoming packet is assigned

to one of eight virtual channels if one of eight is idle

If all channels are busy,wait

Page 70: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

ARPANET ARQ

Page 71: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

ARPANET ARQ More overhead is required Sequence number modulo 2 Each frame carries information for all 8

virtual channels ack information is repeated so often(Typically,only one retx is required in forward direction)

Undesirable : packets released at receiver in a different order

Page 72: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Section 2.5

Framing

Page 73: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.5 Framing Decide where successive frames

start and stop1. Character-based framing : use special

control characters for idle fill and to indicate frame beginning and ending

2. Bit-oriented framing with flags:use special bit string(flag)

3. Length counts:in a field of the header

Page 74: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.5.1 Character-Based Framing

SYN(synchronous idle) : provides idle fill b/w frames

STX(start of txt) ETX(end of text)

Page 75: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Character-Based Framing

Page 76: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Character-Based Framing If the packet to be transmitted in

an arbitrary binary string,packet might contain ETX character ,for example trouble!transparent mode:DLE character is

inserted before STX (Data Link Escape)

DLE in data:DLE DLE DLE E.g. : (x)DLE ETX end of frame

(x)DLE DLE ETX DLE ETX 的 Data

Page 77: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Character-Based Framing

Page 78: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Character-Based Framing Disadvantages

Excessive use of framing overhead Each frame must consist of an integer

number of characters What happens if error?

Error in DLE ETX ending a frame : won't detect end of frame

Error in data causes DLE ETX: interpret as end of frame

Probability : 2-L CRC undetected

Page 79: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.5.2 Bit-Oriented Framing : Flags

Another approach : use a flag at the end of frame

Bit stuffing is used to avoid confusing b/w data ad flag

Difference b/w bit-oriented & character-based framing:bit-oriented can have any length of bits

For example : 0160 as a flag to indicate frame ending Rule : insert (stuff) a 0 into data string of the

frame proper after each successive 5 1`s

Page 80: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

Page 81: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

After stuffing : never contains more than 5 consecutive 1`s.If a string of 5 1`s is followed by a 1 frame end 016 : frame end 016 0 : normal frame termination 016 1 : abnormal termination abort

Page 82: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

討論( fig 2.36 ) The first stuffed bit : not necessary( 不

會混淆,因為 just start) Second stuffed bit : necessary Third stuffed bit : could be eliminated Fourth stuffed bit : required( 無法分辨

0 是否 stuffed)by modifying stuffing rule, but the reduction of overhead is negligible

Page 83: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

Consider the overhead Assume a frame(before bit stuffing)

consists of i id random binary variables with equal probability 0 or 1

Assume for increased generality that the flag uses 01j for some j

01j0 : normal termination 01j+1 : abnormal

Page 84: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

An insertion will occur at the i-th bit of the original frame (for i j)if the string from i-j+1 to I is 01j-1

probability = 2-j

An insertion will also occur (for i 2j-1)if string from i-2j+2 to i is 012j-2(01j-11j-1)probability = 2-2j+1 (ignore this term,太小 )

Page 85: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

Bit j-1 occur an insertion if the first j-1 bits are all 1`s probability = 2-j+1

Recall:Expected value of a sum of r.v`s =Expected number f insertions in a frame= for k(original frame length) j-1Expected number of insertions2-j+1 + (k-j+1)2-j = (k-j+3)2-j

svr `.

i

bitth -iat insertions ofnumber expected

Page 86: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

E{overhead} = (E{k}-j+3)2-

j+j+1(2.33) j+1 means termination string

Since E{k}>>jE{overhead} E{k}2-

j+j+1(2.34)

Page 87: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

Minimize(2.34) for a given E{k}find optimal j So, optimal j must :

E{k}2-j+j+1 < E{k}2-j-1+j+2E{k}2-j-1 <1smallest j : j = log2E{k} (2.36)

E{overhead} log2E{k} +2 (2.37) For example

if E{k} = 1000 bits , optimal j = 9E{overhead} 12 bitsfor j =6 , E{overhead} 23 bits

Page 88: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.5.3 Length Fields Basic problem in framing

Determine where each idle fill string ends(trivial, when pattern is broken) where each frame ends:harder

Include a length field in the frame header(e.g. DECNET) length field(overhead) must have at least log2Kmax +1 bits where Kmax is maximum frame size

Compared to 2.37similar overhead Question

Any other method requires smaller overhead

Page 89: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

Information theory By source coding theorem

Given any probability assignment P(K) on frame lengths.Minimum expected number of bits that can encode such a length is at least entropy of that distribution

(2.38)

at least this many bits of framing overhead to specify length

bits 1

log2 P(K)P(K)H

K

Page 90: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction
Page 91: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction
Page 92: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

If uniform : P(K) = 1/Kmax for 1 K Kmax

H = log2Kmax

If geometric distance on lengthsH= log2E{K}+log2e for large E{K}(2.37)-1/2

Note : geometric : have largest entropy. i.e.requires more bits than any other distance

Page 93: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

If one does this for a geometric distance unary-binary encoding

In particular , for a given j , K = i2j+r;0r<2j

Encoding for K : i 個 0`s followed by a 1 (unary encoding of i) followed by ordinary binary encoding of r (j bits)

For example : if j=2 , k=7 i=1,r=3 so, K = 01 11

Page 94: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Bit-Oriented Framing : Flags

End of encoding : occurring j bits after the first 1 .

In general : K (maps) bit string of length K/2j +1+j

E{overhead} E{K}2-j+1+j (2.40)與 (2.34) 相同Again , minimize by choosing j = log2E{K}

Page 95: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.5.4 Framing with Errors Error in the flag will not detect frame-end

until next flag is detected CRC check with 2 frames (undetected probability = 2-L)

Error within the frame to change a bit string into the flag 0160

0100110111001…(sent)0100111111001…(received)Probability 1/32 Kp , where p is bit error probability using CRC, undetected probability = 2-L

Page 96: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Framing with Errors If length field has error causes

receiver to look for CRC in wrong place 2-L

Page 97: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Framing with Errors There are several partial solutions

to the above problems , but none are without disadvantages Using a fixed-length header for each

frame , and put length of frame in header , and header has its own CRC

If error in length field , still got CRC. But have to resynchronize after such an error. 因為 will not know when next frame starts. 2 CRC`s must be used inefficient some what!

Page 98: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Framing with Errors Put length field of one frame into

trailer of the preceding frame Avoid inefficiency , but still requires a

special synchronizing sequence after each detected error

Require a special header whenever length of next frame is unknown

Use a longer CRC Reduce probability of falsely accepting a

frame

Page 99: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Framing with Errors Regard framing as being at a higher

layer than ARQ Packets would be separated by flags Resulting sequence of packets & flags

would be divided into fixed-length frames. ( If a packet ended in middle of a frame idle fill)

Because of fixed-length , CRC would always be found

Disadvantage : delay A packet could not be accepted until entire

frame containing end of packet was accepted

Page 100: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.5.5 Maximum Frame(packet) Size

Variable packet lengths Most existing packet networks

Use very short frames with a fixed length ISDN,ATM:53bytes

Page 101: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Maximum Frame(packet) Size

Variable frame length Fixed number V of overhead bits Let Kmax = maximum length of a packet Assume each message is broken up into

as many maximum-length packets as possible with last packet containing what is left over

message of length M M/Kmax packets Total bits transmitted = M + M/Kmax V

Page 102: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Maximum Frame(packet) Size

Kmax 越大越好1. As Kmax ,

fraction overhead

2. Processing on a frame basis 1. Kmax , processing

maxK

M

V

V

maxK

Page 103: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Maximum Frame(packet) Size

Kmax 越小越好1. Pipeline

Assume a packet must be completely received over one link before starting transmission over the next

If message is broken into several packets , earlier packets may proceed along the path on first link reducing overall message delay

Page 104: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Maximum Frame(packet) Size

Page 105: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Maximum Frame(packet) Size(pipeline cont`d)

Let's consider combined effects of overheads & pipelining Assume message transmitted over j equal-

capacity links and that network is lightly loaded(no waiting packets) and ignore propagation delay

Total time T required to transmit message to destination

T = time for first packet to travel over the first j-1 links + time for entire message to travel over the final link

Page 106: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Maximum Frame(packet) Size (pipeline cont`d)

Assume MKmax

Let C be capacity of each link

TC = number of bit transmission times =(Kmax + V)(j-1) + M + M/Kmax V

Approximate : E{M/Kmax } = E{M/Kmax}+1/2

E{TC} (Kmax+V)(j-1)+E{M}+E{M}V/Kmax +V/2

Page 107: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Maximum Frame(packet) Size (pipeline cont`d)

to minimize E{TC}

so, Kmax

An overhead V , Kmax

As path length j , Kmax In practice , see if delay is important

maxK

1

}{

j

VME

Page 108: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Maximum Frame(packet) Size (pipeline cont`d)

Delay for stream-type traffic(such as voice) delay from when a given bit enters the

network until that bit leaves Consider the light leading case

Assume arrival rate R Packet length K The first bit in a packet is held up for K/R waiting

time for packet to be assembled Along the path , link capacities C1,C2…(>R) A given packet is delayed by [(K+V)/Ci ] on i-th link

Page 109: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Maximum Frame(packet) Size (pipeline cont`d)

Total delay

[(K+V)/Ci ] K/Ri for each link i T as K until [(K+V)/Ci ] = K/R for some

link yields minimum delay (i.e. small K) Under heavy-loading

Use long packets by some users increases delay for all users

(2.45) 1

)( i iC

VKR

KT

Page 110: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Maximum Frame(packet) Size

2. Retransmission increase waiting time small maximum packet size

3. Large frame have higher probability of error than small frames

In WAN , frame size order of 1~ a few K bits

In LAN , much longer frame size , 因為single multi access link

Page 111: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Maximum Frame(packet) Size

Fixed frame length Determine end of frame same Optimal packet length smaller

Page 112: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Homework One 2.15 2.16 2.17 2.30 2.33 2.39 共六題

Page 113: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Section 2.8

Point-to-Point Protocols at Network Layer

Page 114: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Major issues Routing Flow control

Here, smaller issue: Transfer of packets between a pair of nodes Distinguish packets of one session from

another Distinguish packets within same session.

Page 115: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.8.1 Session ID & addressing Brute-force approach : source &

destination ID allows different packets of same paths → But considerable overhead

If uses virtual circuit(VC) →far less overhead Each link shared by a set of “virtual channels” When set up, a path is established,use one

unused virtual channel to that session.

Page 116: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Virtual Channel

Page 117: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Session ID & addressing Header:virtual channel #

→because limited capacity of link. so upper bound on #of sessions

→use a fixed # of bits(overhead)

Page 118: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Session ID in TRMNET 1970

Page 119: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Session ID & addressing Note: data from multiple sessions are

included in a single frame Go back n ARQ with modulo m=8 Virtual channel # : identify session

→”statistical multiplexing “ : link is multiplexed between virtual channels Sessions are served in “round-robin” Each frame : takes some chars from each

session

Page 120: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Session ID in codex networks Again, multiple sessions

transmitting chars within the same frame

But, a more efficient encoding is used to represent VC#

Four bit “nibbles”

Page 121: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Figure 2.49

Page 122: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Figure 2.49 Map char into one nibble(highly

probable) Map char into two nibble(less likely) Map char into three nibble(least likely)

Packet header : 1 nibble for start record

1 or more nibble for session#─under heavy loading : header =1byte

Page 123: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.8.2 packet numbering, Window Flow Control,Error Recovery Reorder or re-tx packets→need packet

numbering can be done in Network or Transport Layer This is necessary, because : at DLC Layer : 1. CRC could fail 2. If link fail, DLC don’t know how many

packets was sent 3. If node fail, packets stored at the node are

lost

Page 124: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Error Recovery(at Network or Transport Layer) Similar to ARQ at DLC Layer Each packet within a session is numbered

modulo m=2k

Different between end-to-end and DLC 1. End-to-end involves 2 sites and subnet in

between DLC : 2 nodes with a link in between 2. Sequence numbering for end-to-end error

recovery involves only packets of a given sessions. DLC : all packets using the link 3. frame stay in order on a link, packets might

arrive out of order in a network.

Page 125: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Error Recovery Note : VC would guarantee in order for

same session, but,link fails→a new path is set up. Last packet on old path might arrive out

of order,relative to first packet on new path.

Packet retx, and arbitrary delay→earlier copy can remain in network until packet numbering wraps around→trouble.

Page 126: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Error Recovery 1. insist use virtual circuits 2. Modulus large enough 3. Packets are destroyed after

lifetime.

Page 127: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Flow Control Use of either go back n or selective

repeat ARQ,also provide flow control :window size=n

Some limitation : 1. If ACK not arrive because of error, packet

should be re-tx. If ACK is delayed due to congestion, packet

should not be re-tx. →difficult to set “time-out”

Page 128: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Flow Control Partial solution(at destination)

1. Slow down the source, but not delay ACK.

2. “permit” : tells source how many packets is prepared to receive.

RN : provide ACK

Page 129: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Discussion : Error recovery at transport vs network layer From practical standpoint, belongs to

transport layer. Large # of networks do not provide reliable

service E.g. internet protocol

Disadvantage for error recovery at transport ACK are slow due to congestion ACK was throw away

→no way to distinguish

Page 130: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Discussion : Error recovery at transport vs network layer When congestion ,

Packet retx→greater congestion More dropped packets→unstable

Page 131: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.8.3 X.25(self-reading)

Page 132: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.8.4 The Internet Protocol(IP) 2 transport layer protocols were

developed along with IP TCP(transmission control protocol) :

reliable VC service UPP(user datagram protocol) :

simply where to sent datagram to destination

Page 133: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.8.4 The Internet Protocol(IP) Primary functions of IP :

1.route datagram through internet 2.provide addressing to identify source &

destination 3.fragment datagram into smaller pieces

Addresses in IP : 32 bits 1.class A(0) : 7 bit network ID, 24 bit host ID 2.class B(10) : 14 bit network ID,16 bit host

ID 3.class C(11) : 22 bit network ID,8 bit host ID

Page 134: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.9 Transport Layer Functions :

1. Breaking message into packets 2. error recovery 3. flow control 4. Multiplexing / Demultiplexing

sessions together

Page 135: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.9.2 In ICP, entire address of a source(or

destination)is called a “socket”. (Network ID, host ID→in IP header ,

user/process ID within that node→”port”→in transport header)

All session between same pair of hosts are multiplexed together at transport layer into a common lower-layer session

Page 136: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.9.3 Error recovery in TCP Enlarge modulus to allow out-of-

order packet arrivals. Some complications :

1. retx timeouts (retx due to congestion,…)

(if done at network layer, better estimate delay)

Page 137: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.9.3 Error recovery in TCP 2. Setting up &tearing down

connection Packet from an old connection entering a

new connection Packet still exist at some nodes after loss

of connection

Page 138: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.9.4 Flow control in TCP/IP Source monitor round-trip delay

Provide measure of congestion Unfair :

”good citizen” session cut back under congestion,

“bad citizen” do not cut back →network resources should be shared fairly,

need to have individual control over session. But, network layer does not know session.

Page 139: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.10.1 ATM(Asynchronous Transfer Mode) Cell: 53 bytes : 48+5(header) Because packetization delay of voice

E.g. 64 kbps voice(by 8 bit sample each 125 sec), time to collect 48 bytes=6 ms.

ATM uses VC Address : (user-network interface) 24 bits16 million

sessions (Internal subnet )28 bits 268 million.

Page 140: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.10.1 ATM(Asynchronous Transfer Mode) Address field is divided into 2

subfield: VCI(Virtual channel identifier) VPI(Virtual path identifier) →sessions sharing same path are

assigned same VPI to be switched together

Page 141: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.10.1 ATM(Asynchronous Transfer Mode) Use CRC to “correct” errors(not just

detect) Bit error rate(fiber)<10-9

Single error correction might remove most errors(note: CRC checks only header)

Why?(voice,videos, tx) Neither ARQ nor framing is required

Bit error rate is quite low Voice, video.

Page 142: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.10.2 Adaptation layer Breaking incoming source data into ATM

cells.(network layer) Used only on entry & exit from the

network(transport layer) Not yet well-defined Different types of input:

Class 1 : CBR : 64 kbps voice… Class 2 : VBR : packetized voice or video Class 3 : connection-oriented data Class 4 : connectionless data : datagram

Page 143: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.10.2 Adaptation layer Class 3(connection-oriented) traffic

Split into 2 sublayer: Convergence &

segmentation/reassembly →flow control error recovery

Page 144: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.10.2 Adaptation layer

‧Class 4(connectionless) traffic Routed still by VC ?? Trouble

Passes through adaptation layer, use a datagram switch

Use permanent VC to carry all datagram between 2 switches

Page 145: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.10.3 Congestion Congestion is still a problem for

broadband networks Due to large data rate for video

applications,etc. 3 mechanisms

1. At connection setup time, negotiate QoS, burstiness.

2. Monitor each connection 3. Use priority bit in ATM header

Page 146: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.10.3 Congestion For connectionless, no negotiation,

Carefully controlled to avoid excessive delays for connection-oriented sessions.

Usually, a higher-layer network handles this.

For negotiation →QoS guarantee

Page 147: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

2.10.3 Congestion

‧For monitor & regular →e.g. leaky bucket (note:For light loaded,allow excessive

traffic ) Discarded later when congestion

For priority : by user to indicate low priority traffic E.g. video/voice compression.

Page 148: Chapter 2 Point-to-Point Protocols and Links. Section 2.1 Introduction

Session ID & addressing