• No results found

CMPE 150 Winter 2009

N/A
N/A
Protected

Academic year: 2021

Share "CMPE 150 Winter 2009"

Copied!
54
0
0

Loading.... (view fulltext now)

Full text

(1)

CMPE 150 – Winter 2009

Lecture 6

January 22, 2009 y ,

P.E. Mantey

(2)

CMPE 150 -- Introduction to Computer Networks

„

Instructor: Patrick Mantey [email protected]

htt // d / t /

http://www.soe.ucsc.edu/~mantey/

„

Office: Engr. 2 Room 595J

„

Office hours: Tuesday 3-5 PM

„

TA: Anselm Kia [email protected]

„

Web site:

http://www.soe.ucsc.edu/classes/cmpe150/Winter09/

„

Text: Tannenbaum: Computer Networks p

(4th edition – available in bookstore, etc. )

(3)

Syllabus

(4)

Assignment #3

Available on the web site:

http://www.soe.ucsc.edu/classes/cmpe150/Winter09/

Due Thursday, January 29, 2009

(5)

Today’s Agenda

„

Link Layer

„

Services

„

Services

„ Framing

„ kind, seq, ack, info

„ Error Control (CRC)

„ Flow Control

„

Protocols

„

Standards

(6)

Data Link Layer Design Issues

„

Provide Services to Network Layer y

1.

Framing

E C l

2.

Error Control

3.

Flow Control

3.

Flow Control

(7)

Cyclic Redundancy Check

„

(8)

l d d h k

Cyclic Redundancy Check

(9)

Cyclic Redundancy Check

At Transmitter, with M = 1 1 1 0 1 1, compute 2rM= 1 1 1 0 1 1 0 0 0 with G = 1 1 0 1 2 M 1 1 1 0 1 1 0 0 0 with G 1 1 0 1

T = 2rM + R [note G starts and ends with “1” ]

Æ R = 1 1 1 Transmit T= 1 1 1 0 1 1 1 1 1

(10)

Cyclic Redundancy Check

At the Receiver, compute:

Note remainder = 0 ÅÆ no errors detected

(11)

Polynomial Code

„ M = 1 1 1 0 1 1 ÅÆ x5 + x4 + x3 + x + 1 = M(x)( )

„ G = 1 1 0 1 ÅÆ x3 + x3 + 1 = G(x)

R(x) = remainder of [23 M(x)/G(x)]

(recall r 3) (recall r = 3)

T(x) = 23 M(x) + R(x)

(12)

Error-Detecting g Codes

Calculation of the polynomial code

checksum.

Ref: Tannenbaum, Fig. 3-8

(13)

CRC Codes

„ CRC-12 G(x) = x12 + x11 + x3 + x2 + x + 1

„ CRC-12 G(x) = x12 + x11 + x3 + x2 + x + 1

„ CRC-15CRC 15 G(x) xG(x) = x16 + x x15 + x x2 + 1 1

„ CRC-CCITT G(x) = x16 + x12 + x5 + 1

„ CRC-32 G(x) = x32 + x26 + x23 + x22 + x16 + x12 + x11

0 8 2

+ x10 + x8 + x7 + x5 + x4 + x2 + x + 1

(14)

CRC Performance

„ Errors go through undetected only if divisible by G(x)

„ With “suitably chosen” G(x) CRC code detects:

All i l bit

„ All single-bit errors

„ All double-bit errors, as long as G(x) has at least three “1s”

„ Any odd number of error as long as G(x) has a factor (x+1)

„ Any odd number of error, as long as G(x) has a factor (x+1)

„ Any burst error for which the length of the burst is less than the length of the G(x) (i.e. “r”)

„ Most larger burst errors

„ For equally-probable errors, with burst of length r+1, b bilit f d t t d i 1/2r 1

probability of an undetected error is 1/2r-1

„ For longer burst, probability of undetected error is 1/2r

„ [adapted from Stallings, Chapter 7, page 205]

(15)

Logic implementation of Logic implementation of

Polynomial Encoder / Decoder

Ref: Stallings, Fig. 7.6

(16)

Ref: Stallings, Fig. 7.6

(17)

Data Link

„

Connects to (adjacent) computers

(connected by a wire or equivalent) (connected by a wire or equivalent)

„

Serial -- Bits delivered in order sent

(18)

Data Link Layer - Functions

„

Provide service interface to the network layer

network layer

„

Dealing with transmission errors

„

Regulating data flow

Slow receivers not swamped by fast senders

(19)

Data Link Layer - Functions

„

Relationship between packets and frames.

frames.

(20)

Services Provided to Network Layer

( ) Vi t l i ti

„

(a) Virtual communication.

„

(b) Actual communication.

(21)

Link Layer Services

„

Unacknowledged Connectionless Service

„

Acknowledged Connectionless Service

„

Acknowledged Connection-oriented Service g

(22)

Link Layer Services

„

Unacknowledged Connectionless Service

Sender just sends no acknowledgments

„ Sender just sends, no acknowledgments

„ No attempt to resend lost frames

„

Acknowledged Connectionless Service

„

Acknowledged Connection-oriented Service

(23)

Link Layer Services

„

Unacknowledged Connectionless Service

„ Sender just sends, no acknowledgmentsj , g

„ No attempt to resend lost frames

„ Used for

Real-time traffic (voice video)

„ Real-time traffic (voice, video)

„ Highly reliable LANS

„ When error control is done at higher layers (e.g.

TCP) TCP)

„

Acknowledged Connectionless Service

„

Acknowledged Connection-oriented Service

(24)

Link Layer Services

„

Unacknowledged Connectionless Service

„ Sender just sends, no acknowledgmentsj , g

„

Acknowledged Connectionless Service

„ No logical connection

„ Frames individually acknowledged

„ Tannenbaum says “an option, not a requirement”

„ BUT:

„ BUT:

„

Acknowledged Connection-oriented Service

„

Acknowledged Connection oriented Service

(25)

Link Layer Services

„

Unacknowledged Connectionless Service

„ Sender just sends, no acknowledgmentsj , g

„

Acknowledged Connectionless Service

„ No logical connection

„ Frames individually acknowledged

„ Tannenbaum says “an option, not a requirement”

„ BUT: large packets become multiple (fixed size) frames

„ BUT: large packets become multiple (fixed size) frames

„ Some frames get through, others lost, then resend of packet is very inefficient vs. resend of lost frames

„

Acknowledged Connection-oriented Service

(26)

Link Layer Services

„ Unacknowledged Connectionless Service

„ Acknowledged Connectionless Service

„ Acknowledged Connectionless Service

„ Acknowledged Connection-oriented Service

„ Connection established before data sent

„ Connection established before data sent

„ Each frame numbered

„ Data link guarantees error-free delivery

„ Each frame received once and only once

(vs. connectionless, where a packet can be received several time – if errors or timeouts occur

„ Provides reliable bit stream to Network Layer

(27)

Connection-Oriented Service

„

Protocol steps

„ 1 establish connection

„ 1. establish connection

„ 2. reliably deliver data stream

„ Number frames

„ Number frames

„ Acknowledgments

„ 3. free the connection3 ee t e co ect o

(28)

Link Layer Connection of Routers in WAN Using Connection

in WAN Using Connection- Oriented Service

Ref: Tannenbaum, Fig. 3-3

(29)

Framing

„

(a) ( )

A frame delimited by flag bytes.y g y

„ (b) Four examples of byte sequences

before and after stuffing. Ref: Tannenbaum, Fig. 3-5

(30)

Framing: Bit Stuffing

Bit stuffing

„ (a)(a) The original data.The original data.

„ (b) The data as they appear on the line.

„ (c) The data as they are stored in receiver’s memory after destuffing.

Ref: Tannenbaum, Fig. 3-6

(31)

Elementary Data Link Protocols

„

Manage data flow at Link Layer

A U t i t d Si l P t l

„

An Unrestricted Simplex Protocol

„

A Simplex Stop-and-Wait Protocol p p

„

A Simplex Protocol for a Noisy Channel

Channel

(32)

Protocol Definitions Protocol Definitions

Continued Æ

Some definitions needed in the protocols to follow Some definitions needed in the protocols to follow.

These are located in the file protocol.h.

(33)

Protocol Definitions Definitions

(ctd.) ( )

Some definitions d d i h

needed in the

protocols to follow.

These are located in the file protocol.h.

(34)

Unrestricted Simplex

Protocol

Protocol

(35)

From Stallings: Data and Computer Communications

(36)

Stop-and-Wait Stop and Wait

• Simplest form of flow control

• Simplest form of flow control.

– Transmitter sends frame and waits.

– Receiver receives frame and sends ACK.

– Transmitter gets ACK, sends other frame,

d it til f t d

and waits, until no more frames to send.

• Good when few frames.

• Problem: inefficient link utilization.

In the case of high data rates or long – In the case of high data rates or long

propagation delays.

(37)

Simplex

St d

Stop-and- Wait

Wait

Protocol

(38)

Animations Animations

http://media.pearsoncmg.com/aw/aw_kurose_network_2/applets/go- back-n/go-back-n.html

http://www.humboldt.edu/%7Eaeb3/telecom/SlidingWindow.html

http://netbook.cs.purdue.edu/othrpags/page15.htm

(39)

From Stallings: Data and Computer Communications

(40)

A Simplex Protocol for a Noisy

Ch l

Channel

A positi e A positive

acknowledgement with retransmission

protocol.

Continued Æ

(41)

A Simplex Protocol for a Noisy A Simplex Protocol for a Noisy Channel (ctd.)

A positive acknowledgement with retransmission protocol.

(42)

Sliding Window Protocols

(43)

Sliding Window Protocols

„

Supports bi-directional data transfer

transfer

„

Full-duplex

„

Full duplex

„

“piggy backing” of acks

(44)

Sliding Window Protocols

„

A One-Bit Sliding Window Protocol

Protocol

„

A Protocol Using Go Back N

„

A Protocol Using Go Back N

„

A Protocol Using Selective

Repeat

(45)

Sliding Window Protocols (2) Sliding Window Protocols (2)

• A sliding window of size 1, with a 3-bit sequence number.

• (a) Initially

• (a) Initially.

• (b) After the first frame has been sent.

• (c)( ) After the first frame has been received.

• (d) After the first acknowledgement has been received.

Tannenbaum Figure 3-13

(46)

Sliding Window

„

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

„

Receiver allocates buffer space for n

frames frames.

„

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

„

Frame sequence number: labels frames

„

Frame sequence number: labels frames.

(47)

Sliding Window

„

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

number of next expected frame.

„

Cumulative ACK : ack’s multiple frames.

E l if i i f 2 3 d 4

„

Example: if receiver receives frames 2,3, and 4, it sends an ACK with sequence number 5,

hi h k’ i t f 2 3 d 4

which ack’s receipt of 2, 3, and 4.

(48)

Sliding Window

„

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 reserves k bit field for sequence numbers, then they can range from 0 … 2

k

-1 , modulo 2

k

.

„

Transmission window shrinks each time frame is

„

Transmission window shrinks each time frame is

sent, and grows each time an ACK is received.

(49)

Example: 3-bit sequence number and window size 7

• A (sender) (receiver)( ) ( ) B

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

0 1

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

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

3 4 RR4 5

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

Stallings Figure 7-4

(50)

A One-Bit Sliding Window Protocol

Continued Æ

(51)

A One-Bit Sliding Window Protocol ( d )

(ctd.)

(52)

1-bit Sequence Number 1 bit Sequence Number

• Distinguish between “original” transmission and “retransmission”

• Sequence number will do this

• Extra long sequence field wasteful of header / channel

• Minimum size = 1 bit !

• Need to distinguish between frame m and frame m+1Need to distinguish between frame m and frame m+1

• Sender keeps trying to send frame m until it is acknowledged

• Sender won’t send m+1 until m is acknowledged

(S d ’t d 2 til 1 i k l d d hi h

• (Sender won’t send m+2 until m+1 is acknowledged – which means m was correctly received and acknowledged )

• Receiver knows what sequence number to expect next

• Arriving frame with wrong sequence number is rejected as a duplicate

• Correctly received frame – with right sequence number – sent to network layer and expected sequence number incremented by 1 modulo 2.

(53)

O Bit Slidi Wi d P t l One-Bit Sliding Window Protocol

„ Two scenarios for protocol 4. (a) Normal case. (b) Abnormal

Th t ti i ( k k t b ) A t i k

case. The notation is (seq, ack, packet number). An asterisk indicates where a network layer accepts a packet.

Tannenbaum Figure 3-15

(54)

Bit Length of a Link Bit Length of a Link

• Assume link is fully occupied

• 1

st

bit is just arriving at the receiver sender has sent continuously

• sender has sent continuously

• R = data rate (bps)

• d = distance (length of link) (meters)

V propagation velocity (meters / second)

• V = propagation velocity (meters / second)

• (~ 2 - 3 x 10 (

8

meters/second) )

• Bit length = Rd / V bits

References

Related documents