university of delaware cpeg 4191 zno class thursday 10/3 zoffice hours: tue 3:15-4 –w 12-1...

55
University of Delaware CPEG 419 1 No Class Thursday 10/3 Office hours: Tue 3:15-4 W 12-1 Evans 315

Post on 20-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 1

No Class Thursday 10/3Office hours: Tue 3:15-4

– W 12-1 – Evans 315

Page 2: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 2

Data Link Layer

Physical layer: sending signals over transmission medium.

Data link layer: responsible for error-free (reliable) communication between adjacent nodes.

Functions: flow control, error control, framing, fragmentation, and addressing (in multipoint medium).

Page 3: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 3

Flow Control

What is it? Ensures that transmitter does not

overrun receiver: limited receiver buffer space.

Receiver buffers data to process before passing it up.

If no flow control, receiver buffers may fill up and data may get dropped.

Page 4: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 4

Stop-and-Wait

Simplest form of flow control. Transmitter sends frame and waits. Receiver receives frame and sends ACK. Transmitter gets ACK, sends other frame, and

waits. This continues until there are no more frames to

send.

This is a good method if the propagation delay and data rate is small. Otherwise, it leads to low link utilization.

Page 5: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 5

Baud rate * bits/symbol * delay = bits10M*10*0.06 = 2500000 bits (2.5Mb)!This is bandwidth * delay = bandwidth delay product.

Suppose that the baud rate is 10Mbaud/s. Suppose that there are 10bits per symbol. Suppose that the propagation delay is 25ms. How many bits can fill the wire?

Bandwidth Delay Product

Suppose that we send a frame of 1500*8 bits over this link and use stop and wait. What is the link utilization?

For a satellite, stop and wait is not a good approach.For a wireless link like 802.11, its ok (and is used)

Page 6: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 6

Transmission Delay

Suppose the data rate is 100Mbps. Suppose the frame is 1500bytes. How long does it take to put the frame on the

wire? (This is transmission delay.)

How long to send a frame over this link if the propagation delay is 25ms?

Page 7: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 7

Sliding Window 1

Allows multiple frames to be in transit at the same time.

Receiver allocates buffer space for n frames.

Transmitter is allowed to send n (window size) frames without receiving ACK.

Frame sequence number: labels frames.

Page 8: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 8

Sliding Window 2

Receiver ack’s frame by including sequence number of next expected frame.

Cumulative ACK: ack’s multiple frames.Example: if receiver receives frames

2,3, and 4, it sends an ACK with sequence number 5, which ack’s receipt of 2, 3, and 4.

Page 9: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 9

Sliding Window 3

Sender maintains sequence numbers it’s allowed to send; receiver maintains sequence number it can receive. These lists are sender and receiver windows.

Sequence numbers are bounded; if frame reserves k-bit field for sequence numbers, then they can range from 0 … 2k -1 and are modulo 2k.

Page 10: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 10

Sliding Window 4

Transmission window shrinks each time frame is sent, and grows each time an ACK is received.

Page 11: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 11

Example

Page 12: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 12

Sliding Window (cont’d)

RR (ready to receive) n acknowledges up to frame n-1.

There is also RNR n, which ack’s up to frame n-1 but no longer accepts more frames.

RNR shuts down the receive window and consequently the transmission window.

Need subsequent RR to re-open window.

Page 13: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 13

Piggybacking

When both endpoints transmit, each keeps 2 windows, transmitter and receiver windows.

Each send data and need to send ACKs.

When sending data, transmitter can “piggyback” the acknowledgment information.

When no data, send just the ACK.

Page 14: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 14

Duplicate ACKs

When no data, must re-send last ACK.

Duplicate ACKs: report potential errors.

Page 15: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 15

Error Detection

Transmission impairments lead to transmission errors: change of 1 or more bits in transmitted frame.

Transmission errors defined using probabilities: transmission medium modeled as a statistical system.

Page 16: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 16

Error Probabilities 1Definitions:

Pb probability of single bit error (bit error rate); constant and independent for each bit.

P1 probability frame received with no errors.

P2 probability frame received with 1 or more undetected errors.

P3 probability frame received with 1 or more detected bit errors, but no undetected ones.

Page 17: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 17

Error Probabilities 2

If no error detection mechanism, P3 = 0.

P1 = (1 - Pb)F and P2 = (1- P1), where F is size of frame in bits.

P1 decreases as Pb increases.

P1 decreases as F increases.

Page 18: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 18

Example64-kbps ISDN channel’s bit error rate is

less than 10-6. User requirement of on average 1 frame with undetected bit error per day. Frame is 1000 bits. In a day, 5.529 x 106 frames transmitted. Required frame error rate of 1/ 5.529 x

106, or P2 = 0.18 x 10-6. But Pb = 10-6, so P1 = (1-Pb)F = 0.999 and P2

= 1 - P1 = 10-3, which is >>> required P2

Page 19: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 19

Error Detection Schemes Transmitter adds additional bits for error

detection.Transmitter computes error detection bits

as function of original data.Receiver performs same calculation and

compares results. If mismatch, then error.P3 probability error detection scheme

detects error; P2 residual error rate or probability error goes undetected.

Page 20: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 20

Parity

Simplest error detection scheme.Append parity bit to data block.Example: ASCII transmission

1 parity bit appended to each 7-bit ASCII character.

Even parity: 8-bit code has even number of 1’s.

Odd parity: 8-bit code has odd number of 1’s.

Page 21: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 21

Parity Check

Example: transmitting ASCII “G” (1110001) using odd parity. Code transmitted is 11100011. Receiver checks received code and if odd

number of 1’s, assumes no error. Suppose it receives 11000011, then

detects error. NOTE: If more than 2 bits in error, may

not be detected.

Page 22: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 22

ISDN Example - Continued

BER = 10-6.Frame errors might occur when two or

more bit errors occur. Or, no frame error if no bit errors or one bit error. 1 – ((1-Pb)1000 + 1000*(1-Pb)999*Pb)= 5e-7 With no parity, the frame error prob. = 10-3

Page 23: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 23

Cyclic Redundancy Check

CRC is one of the most effective and common error detecting schemes.

Represent frames as polynomials M= 1010001101 -> x9+x7+x3+x2+x0

Both source and destination use a generator polynomial G – r bits/r-1 degree polynomial

Idea: Transmit extended frame [M|V], such that the polynomial representation is exactly divisible by G. Thus, if G does not exactly divide the received frame, there is an error.

Page 24: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 24

CRC

How to find V such that G exactly divides [M|V]? Divide xrM by G. Set V = the remainder. [M|V] = xrM + V [M|V]/G = (xrM + V)/G = xrM/G + V/G =

S + V/G + V/G = S + 2V/G. But in binary 2 is the same as zero. So [M|V] / G = S.

Page 25: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 25

CRC Example

Frame M 1010001101 = x9+x7+x3+x2+x0.

Pattern G 110101.Dividing (frame*25) by pattern results

in 01110.Thus T 101000110101110.Receiver can detect errors unless

received message Tr is divisible by G.

Page 26: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 26

CRC Performance and Generators Instead of [M|V] we receiver [M|V] + E (E is the error). Burst errors – CRC detects bursts of length r or less.

a string of errors, with E = 0 …0 1 X X X X 1 0 … E(x) = xi(xk-1 + … + 1) where the burst length is k. If G is degree k or greater and G has a 0th degree term, then G

will not divide E.

dividemight

1

122

x

xxx

xG

xE i

dividenever will

12

12

xx

xx

xG

xE ie.g.

Will CRC detect single bit errors?Suppose that you use 4 bits (as in Ethernet), and BER is 106 what is the frame error probability?

Page 27: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 27

CRC Performance and Generators

Burst Errors Continued If the burst has length r+1, then the

errors will not be detected if the burst is the same as G. If an error of length r+1 occurs and all combinations of errors are equally likely, then the burst will match G with prob. ½r-1. (So prob is BERr+1 x ½r-1)

In general, for longer bursts, the prob. is ½r

Page 28: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 28

CRC

Lastly, if G contains x+1 as a factor, and E has an odd number of bit, then G will not divide E.

In IEEE 802x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7

+ x5 + x4 + x2 + x + 1

CRC can be implemented in hardware with registers.

Problem: errors can occur in some pattern, so the probabilities are not quite right.

Page 29: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 29

Error Correcting Codes

Hamming distance between bit strings: The number of bits where the string

differ XOR them and count the 1’s 1 0 1 0 0

1 0 0 1 00 0 1 1 0 = 2 – the distance is two.

Page 30: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 30

Error Correcting codes

Take an n bit string and encode it as n+k bits in such a way that each encoded n bit string is at least d distance from any other encoded n bit string. Then you can detect errors of length d.

Do the same thing, but make it so the distance between any encoded n bit string is 2d+1 bits. Then the an error of d bits or less can be corrected by assigning the string to its closest legal value.

Page 31: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 31

Error Correcting Code

Legal strings – these are the encoded versions of n bit strings.

Illegal strings – no n bit string is encode to these

Page 32: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 32

Error Correcting Code

Suppose that this code is 0 1 0 1 0 But this code 0 1 1 0 1 0 is received

Then you know an error occurred, and you figure that what was meant to be sent is the code 0 1 0 1 0 (the nearest legal neighbor).

Page 33: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 33

Error Correcting Code

Suppose that this code is 0 1 0 1 0 But this code 0 1 1 0 1 1 is received

Then you know an error occurred. But you are sure which code was actually sent.

Page 34: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 34

Error ControlMechanisms to detect and correct

transmission errors.Consider 2 types of errors:

Lost frame: frame is sent but never arrives. Damaged frame: frame arrives but in error.

Error control: combination of error detection, feedback (ACK or NACK) from receiver, and retransmission by source.

Coupled with flow control feedback.

Page 35: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 35

ARQ

ARQ: automatic repeat request.Works by creating a reliable data link

from an unreliable one.3 versions:

Stop-and-wait ARQ. Go-back-N ARQ. Selective-reject ARQ.

Page 36: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 36

Stop-and-Wait ARQSingle outstanding frame at any time.Simple but inefficient.Use of timers to trigger retransmission of

data or ACKs.2 types of errors:

Damaged or lost frame. Damaged or lost ACK.

Sequence numbers alternate between 0 and 1.

Page 37: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 37

Stop-and-Wait ARQ: ExampleSender ReceiverFrame 0

ACK1

Frame 1ACK 0

Frame 0

Timeout

Frame 0

ACK 1

Timeout

Frame 0

ACK 1 B discards duplicate.

Page 38: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 38

Go-Back-N ARQVariation of sliding window for error

control.Allows a window’s worth of frames to be in

transit at any time.RR: ack’s receipt of frame.REJ: negative acknowledgment indicating

the frame in error.Destination discards frame in error plus

subsequent frames.

Page 39: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 39

Go-Back-N ARQ ExampleS R S Rf0

f1f2

rr3f3

f4

f5rr4

Errorf6

rej5f7

f5f6

rr6 f7

5, 6, 7rexm.

f7

f0

f1rr0

rr(P bit=1)

rr2

f2

Timeout

Discarded

Page 40: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 40

Go-Back-N ARQ Issues

For k-bit sequence number, maximum window size is (2k-1). If window size is too large, ACKs may be

ambiguous: not clear if ACK is a duplicate ACK (errors occurred).

Example: 3-bit sequence number and 8 -frame window.Source transmits f0, gets back rr1, then

sends f1--f0, and gets back another rr1. ???

Page 41: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 41

Selective-Reject ARQ

Only frames transmitted are the ones that are NACK’ed (SREJ) or that timeout.

More efficient than Go-Back-N regarding amount of retransmissions.

But, receiver must buffer out-of-order frames.

More restriction on maximum window size; for k-bit sequence #’s, 2k-1 window.

Page 42: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 42

Example Data Link Layer Protocol

High-Level Data Link Control (HDLC) Widely-used (ISO standard). Single frame format. Synchronous transmission.

Page 43: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 43

HDLC: Frame Format

Flag: frame delimiters (01111110). Address field for multipoint links. 16-bit or 32-bit CRC. Refer to book (pages 176-185) for more

details.

8bits

8ext.

8 or16

variable 16 or32

8

flag address control data FCS flag

Page 44: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 44

Other DLL Protocols 1

LAPB: Link Access Procedure, Balanced. Part of the X.25 standard. Subset of HDLC. Link between user system and switch. Same frame format as HDLC.

LAPD: Link Access Procedure, D-Channel. Part of the ISDN standard.

Page 45: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 45

Other DLL Protocols 2

LLC: Logical Link Control. Part of the 802 protocol family for LANs. Link control functions divided between

the MAC layer and the LLC layer. LLC layer operates on top of MAC layer.

Dst.MACaddr

Src.MACaddr

FCSDst.LLCaddr

Src.LLCaddr

LLCctl. DataMAC

control

Page 46: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 46

Other DLL Protocols 3

SLIP: Serial Line IP Dial-up protocol. No error control. Not standardized.

PPP: Point-to-Point Protocol Internet standard for dial-up

connections. Provides framing similar to HDLC.

Page 47: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 47

Multiplexing

Sharing a link/channel among multiple source-destination pairs.

Example: high-capacity long-distance trunks (fiber, microwave links) carry multiple connections at the same time.

MU

X

...

DE

MU

X ...

Page 48: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 48

Multiplexing Techniques

3 basic types: Frequency-Division Multiplexing (FDM). Time-Division Multiplexing (TDM). Statistical Time-Division Multiplexing

(STDM).

Page 49: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 49

FDM 1

High bandwidth medium when compared to signals to be transmitted.

Widely used (e.g., TV, radio).Various signals carried simultaneously

where each one modulated onto different carrier frequency, or channel.

Channels separated by guard bands (unused) to prevent interference.

Page 50: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 50

FDM 2

Time

Frequency

1 2 N

Page 51: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 51

TDM 1

TDM or synchronous TDM.High data rate medium when

compared to signals to be transmitted.

Time

Frequency

12

N

Page 52: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 52

TDM 2

Time divided into time slots.Frame consists of cycle of time slots.In each frame, 1 or more slots

assigned to a data source.

1 2 N... 1 2 ... N

frame Time

U1 U2 ... UN

Page 53: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 53

TDM 3

No control info at this level.Flow and error control?

To be provided on a per-channel basis. Use DLL protocol such as HDLC.

Examples: SONET (Synchronous Optical Network) for optical fiber.

+’s: simple, fair.-’s: inefficient.

Page 54: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 54

Statistical TDM 1Or asynchronous TDM.Dynamically allocates time slots on

demand.N input lines in statistical multiplexer, but

only k slots on TDM frame, where k < n.Multiplexer scans input lines collecting

data until frame is filled.Demultiplexer receives frame and

distributes data accordingly.

Page 55: University of Delaware CPEG 4191 zNo Class Thursday 10/3 zOffice hours: Tue 3:15-4 –W 12-1 –Evans 315

University of Delaware CPEG 419 55

STDM 2

Data rate on mux’ed line < sum of data rates from all input lines.

Can support more devices than TDM using same link.

Problem: peak periods. Solution: multiplexers have some buffering

capacity to hold excess data. Tradeoff data rate and buffer size (response

time).