32
Data and Computer Communications Updated: 2/9/2009

Data and Computer Communications Updated: 2/9/2009

Embed Size (px)

Citation preview

Page 1: Data and Computer Communications Updated: 2/9/2009

Data and Computer Communications

Updated: 2/9/2009

Page 2: Data and Computer Communications Updated: 2/9/2009

Data Link Control Protocols They are required to provide a layer

of logic to manage exchange of data over a link frame synchronization flow control error control addressing control and data link management

Page 3: Data and Computer Communications Updated: 2/9/2009

Flow Control Objectives

Sender does not flood the receiver - prevents buffer overflow

Maximize throughput Basic Idea

Sender throttled until receiver grants permission Impacted by

Transmission time time taken to emit all bits into medium

Propagation time time for a bit to traverse the link

Two basic types are discussed Stop-and-Wait FC Sliding Window FC

Page 4: Data and Computer Communications Updated: 2/9/2009

Space Time Diagrams A virtual time

sequence diagram

Illustrating the sender-receiver relationship

Page 5: Data and Computer Communications Updated: 2/9/2009

Stop and Wait Flow Control

Basic Idea Source transmits frame Destination receives frame and replies

with acknowledgement (ACK) Source waits for ACK before sending next Destination can stop flow by not send ACK

Page 6: Data and Computer Communications Updated: 2/9/2009

Performance Works well for a few large frames Stop and wait becomes inadequate if large block of

data is split into small frames

Page 7: Data and Computer Communications Updated: 2/9/2009

Efficiency of Stop&Wait

Utilization (or efficiency) can be calculated as:

We define parameter a:

Examples of signal speed: Light in vacuum: 300 m/msLight in fiber: 200 m/msElectricity: 250 m/ms

The textbook uses B for tprop and L for tframe

What happens if a changes?

Page 8: Data and Computer Communications Updated: 2/9/2009

Performance Examples

Assume data rate = 56 Kbps: Find tfrme, a, and Utilization

Assume frame size is 500 bytesFind tfrme, a, and Utilization

How high is the satellite?

Page 9: Data and Computer Communications Updated: 2/9/2009

Performance Examples

Page 10: Data and Computer Communications Updated: 2/9/2009

Maximum Utilization

Utilization

a

Ideal

Actual

Plot the efficiency plot

For the problems using Matlab

Page 11: Data and Computer Communications Updated: 2/9/2009

Sliding Windows Flow Control Allows multiple numbered frames to be transmitted

Receiver has buffer W long Transmitter sends up to W frames without ACK

Receiver sends an ACK ACK includes number of next frame expected

Sequence number is bounded by size of field (k) frames are numbered modulo 2k

giving max window size of up to 2k - 1 Receiver can ack frames without permitting further

transmission (Receive Not Ready) Must send a normal acknowledge to resume

if have full-duplex link, can piggyback ACks

Page 12: Data and Computer Communications Updated: 2/9/2009

Sliding Window DiagramW=5, 3 bits are required,ACK: 0,1,2,3,4,0,1,

Page 13: Data and Computer Communications Updated: 2/9/2009

Sliding Window Example

W=7, 3 bits are required,ACK: 0,1,2,3,4,6,7,0,1,

Why W is not 8?

Window shrinking until ACK is received

Window expands as soon as ACK is sent

Window expands as soon as ACK is received

Page 14: Data and Computer Communications Updated: 2/9/2009

Efficiency of Sliding Window Protocol

Page 15: Data and Computer Communications Updated: 2/9/2009

Error Control Detection and correction of errors such as:

Lost frames Damaged frames

Common techniques use: Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement & retransmission

Page 16: Data and Computer Communications Updated: 2/9/2009

Automatic Repeat Request (ARQ)

Error control mechanisms used in stop and wait go back N selective reject (selective retransmission)

Page 17: Data and Computer Communications Updated: 2/9/2009

ARQ in Stop and Wait

Source transmits single frame Wait for ACK If received frame damaged, discard it

transmitter has timeout if no ACK within timeout, retransmit

if ACK damaged,transmitter will not recognize it transmitter will retransmit receive gets two copies of frame use alternate numbering and ACK0 /

ACK1 pros and cons

simple inefficient

ACK0 / ACK1

Remember: Special case where W=1

Page 18: Data and Computer Communications Updated: 2/9/2009

ARQ in Go Back N Based on sliding window If no error, ACK (RR) as usual

Use window to control number of outstanding frames

If error, reply with rejection (REJ) Discard that frame and all future

frames until error frame received correctly

Transmitter must go back and retransmit that frame and all subsequent frames

Lost ACK, P=1

Frames 5 & 6 are resent

Nothing sent untilACK is received

Lost ACK, P=1

Page 19: Data and Computer Communications Updated: 2/9/2009

Go Back N Scenarios which are handled

Damaged Frame Frame received with error Frame lost Last frame lost

Damaged Ack One ack lost, next one makes it All acks lost

Damaged Nack Maximum Window = 2n -1 with n-bit

sequence numbers

Page 20: Data and Computer Communications Updated: 2/9/2009

Selective Reject Also called selective retransmission Only rejected frames are

retransmitted Subsequent frames are accepted by

the receiver and buffered Cons and pros

Minimizes retransmission Receiver must maintain large

enough buffer More complex logic in transmitter Applications

Less widely used Useful for satellite links with long

propagation delays

ResendOnly Corrupted one

P=1; Resent ACK

Nothing sent untilACK is received

Only frame4 is resent

Applet: http://media.pearsoncmg.com/aw/aw_kurose_network_3/applets/SelectRepeat/SR.html

Page 21: Data and Computer Communications Updated: 2/9/2009

Performance ComparisonP is the probability that a single frame is in error; Assume that ACK and NAK are never in error.

Page 22: Data and Computer Communications Updated: 2/9/2009

High Level Data Link Control (HDLC)

An important data link control protocol station types:

Primary – issue commands Secondary - issue Responses Combined - issues commands and responses

link configurations Unbalanced - 1 primary, multiple secondary Balanced - 2 combined stations

Page 23: Data and Computer Communications Updated: 2/9/2009

HDLC Transfer Modes

Normal Response Mode (NRM) Response from secondary

Asynchronous Balanced Mode (ABM) Combined Station, either station initiates

transmission, has no polling overhead, widely used

Asynchronous Response Mode (ARM) unbalanced config, secondary may initiate

transmit without permission from primary, rarely used

Page 24: Data and Computer Communications Updated: 2/9/2009

HDLC Frame Structure synchronous transmission of frames single frame format used for all data types

Header Data Trailer

Frame Check Sequence = FCS

Page 25: Data and Computer Communications Updated: 2/9/2009

Flag Fields and Bit Stuffing

From Jain

Page 26: Data and Computer Communications Updated: 2/9/2009

Address Field Identifies secondary station that sends or

receives frame Usually 8 bits long May be extended to multiples of 7 bits

LSB indicates if is the last octet (1) or not (0) all ones address 11111111 is broadcast

Frames arte multiples of 8-bit (octets)Last octet

Page 27: Data and Computer Communications Updated: 2/9/2009

Control Field

Different for different frame type (I, S, U) Information - data transmitted to user (next

layer up) Flow and error control piggybacked on information

frames (includes N(s) and N(R)) Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control

First 1-2 bits of control field identify frame type I=0, S=10, U=11

Page 28: Data and Computer Communications Updated: 2/9/2009

Control Field Use of Poll/Final bit depends on context

In command frame is P bit set to 1 to solicit (poll) response from peer

In response frame is F bit set to 1 to indicate response to soliciting command

Sequence number usually 3 bits can extend to 7 bits as shown below

S=Supervisory function bit

http://www.erg.abdn.ac.uk/users/gorry/course/dl-pages/hdlc-control.html

Page 29: Data and Computer Communications Updated: 2/9/2009

Information & FCS Fields

Information Field Exists in information and some

unnumbered frames It must contain integral number of octets Variable length

Frame Check Sequence Field (FCS) Used for error detection Either 16 bit CRC or 32 bit CRC

Page 30: Data and Computer Communications Updated: 2/9/2009

HDLC Operation consists of exchange of information,

supervisory and unnumbered frames Consists of three phases

Initialization by either side, set mode & sequence

data transfer with flow and error control using both I & S-frames (RR, RNR, REJ, SREJ)

disconnect when ready or fault noted

Page 31: Data and Computer Communications Updated: 2/9/2009

HDLC Operation Example

Refer to HDLC Commands HDLC Commands

Set normal response/responses

Set mode accepted

Full Duplex

Page 32: Data and Computer Communications Updated: 2/9/2009

HDLC Operation Example