30
EECC694 - Shaaban EECC694 - Shaaban #1 lec #4 Spring2000 3-16-2000 Data Link Layer: Flow Control Data Link Layer: Flow Control Stop-and-Wait Data Link Protocols Stop-and-Wait Data Link Protocols Such elementary protocols are also called PAR (Positive Acknowledgment with Retransmission) or ARQ (Automatic Repeat reQuest). Data frames are transmitted in one direction (simplex protocols ) where each frame is individually acknowledge by the receiver by a separate acknowledgment frame. The sender transmits one frame, starts a timer and waits for an acknowledgment frame from the receiver before sending further frames. A time-out period is used where frames not acknowledged by the receiver are retransmitted automatically by the sender. Frames received damaged by the receiver are not acknowledged and are retransmitted by the sender when the expected acknowledgment is not received and timed out. A one bit sequence number (0 or 1) is used to distinguish between original data frames and duplicate retransmitted frames to be discarded . Such protocols result in a substantial percentage of wasted bandwidth and may fail under early time-out situations.

Data Link Layer: Flow Control Stop-and-Wait Data …meseec.ce.rit.edu/eecc694-spring2000/694-3-16-2000.pdf · EECC694 - Shaaban #1 lec #4 Spring2000 3-16-2000 Data Link Layer: Flow

Embed Size (px)

Citation preview

EECC694 - ShaabanEECC694 - Shaaban#1 lec #4 Spring2000 3-16-2000

Data Link Layer: Flow ControlData Link Layer: Flow ControlStop-and-Wait Data Link ProtocolsStop-and-Wait Data Link Protocols

• Such elementary protocols are also called PAR (Positive Acknowledgmentwith Retransmission) or ARQ (Automatic Repeat reQuest).

• Data frames are transmitted in one direction (simplex protocols ) whereeach frame is individually acknowledge by the receiver by a separateacknowledgment frame.

• The sender transmits one frame, starts a timer and waits for anacknowledgment frame from the receiver before sending further frames.

• A time-out period is used where frames not acknowledged by the receiverare retransmitted automatically by the sender.

• Frames received damaged by the receiver are not acknowledged and areretransmitted by the sender when the expected acknowledgment is notreceived and timed out.

• A one bit sequence number (0 or 1) is used to distinguish between originaldata frames and duplicate retransmitted frames to be discarded .

• Such protocols result in a substantial percentage of wasted bandwidthand may fail under early time-out situations.

EECC694 - ShaabanEECC694 - Shaaban#2 lec #4 Spring2000 3-16-2000

Definitions for Data Link Protocols (protocol.h) 1/2

EECC694 - ShaabanEECC694 - Shaaban#3 lec #4 Spring2000 3-16-2000

Definitions for Data Link Protocols (protocol.h) 2/2

EECC694 - ShaabanEECC694 - Shaaban#4 lec #4 Spring2000 3-16-2000

Protocol 1: An Unrestricted Simplex ProtocolProtocol 1: An Unrestricted Simplex Protocol• Transmission in one direction

• The receiver is always ready to receive the next frame (has infinite buffer storage).

• Error-free communication channel.

• No acknowledgments or retransmissions used.

• If frame has d data bits and h overhead bits, channel bandwidth b bits/second:

maximum channel utilization = data size/frame size = d/(d + h)

maximum data throughput = d/ (d + h ) * channel bandwidth = d/ (d + h ) * b

Data Frame 1Data Frame 2Data Frame 3Data Frame 4Data Frame 5Data Frame 6

Sender Receiver

One wayChannel delay or latency l

Frametransmission time = (d+h)/b

b = channel bandwidth

:::

:::

:::

:::

EECC694 - ShaabanEECC694 - Shaaban#5 lec #4 Spring2000 3-16-2000

An

Un

restricted S

imp

lex Protocol

An

Un

restricted S

imp

lex Protocol

EECC694 - ShaabanEECC694 - Shaaban#6 lec #4 Spring2000 3-16-2000

Protocol #2: A Simplex Stop-and-Wait ProtocolProtocol #2: A Simplex Stop-and-Wait Protocol• Simplex: Data transmission in one direction

• The receiver may not be always ready to receive the next frame (finite buffer storage).• Receiver sends a positive acknowledgment frame to sender to transmit the next data frame.• Error-free communication channel assumed. No retransmissions used.

• Maximum channel utilization ≈ (time to transmit frame /round trip time) * d/(d + h)

≈ d/ (b * R)

• Maximum data throughput ≈ channel utilization * channel bandwidth

≈ d/ (b * R) * b = d/ R

Data Frame 1

SenderSender ReceiverReceiver

Acknowledgment Frame

Data Frame 2

Acknowledgment Frame

Round trip time, R

Time

:::

:::

EECC694 - ShaabanEECC694 - Shaaban#7 lec #4 Spring2000 3-16-2000

Data L

ink

Protocol #2

Data L

ink

Protocol #2

A S

imp

lex Stop

-and

-Wait P

rotocolA

Sim

plex S

top-an

d-W

ait Protocol

EECC694 - ShaabanEECC694 - Shaaban#8 lec #4 Spring2000 3-16-2000

Protocol 3: A Simplex Positive Acknowledgment withRetransmission (PAR) Protocol

• The receiver may not be always ready to receive the next frame (finite buffer storage).• Noisy communication channel; frames may be damaged or lost.

– Frame not received correctly with probability p• Receiver sends a positive acknowledgment frame to sender to transmit the next data

frame. Any frame has a sequence number, either 0 or 1• Maximum utilization and throughput similar to protocol 2 when the effect of errors is

ignored.

SenderSender ReceiverReceiver

Ack Frame, sequence # 0

Round trip time, R

Data Frame 1, sequence # 1

Data Frame 1, sequence # 0

Ack Frame, sequence # 1

Data Frame 1, sequence # 0

Time

:::

:::

EECC694 - ShaabanEECC694 - Shaaban#9 lec #4 Spring2000 3-16-2000

Protocol 3: A Simplex PAR Protocol (continued)Effect of Errors

• The sender starts a timer when transmitting a data frame.• If data frame is lost or damaged (probability = p):

– Receiver does not send an acknowledgment– Sender times out and retransmits the data frame

SenderSender

ReceiverReceiver

Time-out Interval

Data Frame 1, sequence # 0

Data Frame 1, sequence # 0

Ack Frame, sequence # 0

Start timer

Time-outRetransmit frame

X Error: Frame lost ordamaged, with probability p

Time

EECC694 - ShaabanEECC694 - Shaaban#10 lec #4 Spring2000 3-16-2000

Data Link Protocol #3 1/2 (sender process)A Simplex positive Acknowledgment with Retransmission Protocol

EECC694 - ShaabanEECC694 - Shaaban#11 lec #4 Spring2000 3-16-2000

Data Link Protocol #3 2/2 (receiver process)A Simplex positive Acknowledgment with Retransmission Protocol

EECC694 - ShaabanEECC694 - Shaaban#12 lec #4 Spring2000 3-16-2000

Data Link Layer: Flow ControlData Link Layer: Flow ControlSliding Window ProtocolsSliding Window Protocols

• These protocols allow both link nodes (A, B) to send and receive data andacknowledgments simultaneously.

• Acknowledgments are piggybacked into an acknowledgment field in thedata frame header not as separate frames.

• If no new data frames are ready for transmission in a specified time, aseparate acknowledgment frame is generated to avoid time-out.

• Each outbound frame contains a sequence number ranging from 0 to2 n-1 (n-bit field). N = 1 for stop-and-wait sliding window protocols.

• Sending window: A set of sequence numbers maintained by the senderand correspond to frame sequence numbers of frames sent out but notacknowledged.

• The maximum allowed size of the sending window w correspond to themaximum number of frames the sender can transmit before receivingany acknowledgment without blocking (pipelining).

• All frames in the sending window may be lost or damaged and thus mustbe kept in memory or buffers until they are acknowledged.

EECC694 - ShaabanEECC694 - Shaaban#13 lec #4 Spring2000 3-16-2000

Sliding Window Data Link ProtocolsSliding Window Data Link Protocols• Receiving window: A set of sequence numbers maintained by the receiver and

indicate the frames sequence numbers it is allowed to receive and acknowledge.

• The size of the receiving window is fixed at a specified initial size.

• Any frame received with a sequence number outside the receiving window isdiscarded.

• The sending window and receiving window may not have the same upper orlower limits or have the same size.

• When pipelining is used, an error in a frame is dealt with in one of two ways:

– Go back n:

• The receiver discards all subsequent frames and sends noacknowledgments.

• The sender times out and resends all the discarded frames starting withfaulty frame.

– Selective repeat:

• The receiving data link stores all good frames received after a bad frame.

• Only the bad frame is retransmitted upon time-out by the sender.

EECC694 - ShaabanEECC694 - Shaaban#14 lec #4 Spring2000 3-16-2000

A Sliding Window Protocol of Size 1 with a 3-bit Sequence NumberA Sliding Window Protocol of Size 1 with a 3-bit Sequence Number

(a) Initialstate

(b)After the first frame has been sent

(c)After thefirst framehas been received

(d)After the first acknowledgmentframe has been received

EECC694 - ShaabanEECC694 - Shaaban#15 lec #4 Spring2000 3-16-2000

Difference Between PAR and Sliding Window ProtocolsDifference Between PAR and Sliding Window Protocols

SenderSender ReceiverReceiver

Data Frame 1, seq # 0

Ack Frame, seq # 0

Data Frame 2, seq # 1

Ack Frame, seq # 1

Data Frame 3, seq # 0

Ack Frame, seq # 0

Ack Frame, seq # 1

Data Frame 4, seq # 1

SenderSender ReceiverReceiver

Ack Frame, seq # 3

DF 1, seq # 0DF 2, seq # 1DF 3, seq # 2

DF 4, seq # 3

Ack Frame, seq # 2Ack F, seq # 1

Stop-and-WaitStop-and-Wait Sliding Window Sliding Windowsequence # from 0 to 3sequence # from 0 to 3

Round Trip Time, R

ACK F, seq # 0

Shown Here: Shown Here:Four Data Frames TransmittedFour Data Frames Transmitted

Positive Acknowledgment with Retransmission

:::

:::

:::

:::

TimeTime

EECC694 - ShaabanEECC694 - Shaaban#16 lec #4 Spring2000 3-16-2000

A 4-Frame Sending WindowA 4-Frame Sending Window

Initial window

After two frames have been acknowledged

After nine frames have been acknowledged

Unacknowledged or Pending Frames

EECC694 - ShaabanEECC694 - Shaaban#17 lec #4 Spring2000 3-16-2000

Data Link Protocol #4 1/2A 1-bit Bi-directional Sliding Window Protocol

EECC694 - ShaabanEECC694 - Shaaban#18 lec #4 Spring2000 3-16-2000

Data Link Protocol #4 2/2A 1-bit Bi-directional Sliding Window Protocol

EECC694 - ShaabanEECC694 - Shaaban#19 lec #4 Spring2000 3-16-2000

Channel Utilization & Data ThroughputChannel Utilization & Data ThroughputFor Sliding Window ProtocolsFor Sliding Window Protocols

b = Channel bandwidth or transmission rate bits/secFS = Frame size = # of data bits + # overhead bits = d + hR = Channel round trip timeN = Send/receive window sizep = Probability frame a data frame is lost or damaged

• Ignoring errors, condition to maximize Utilization/Throughput: Time to transmit N frames ≥ Round trip time FS/b * N = (d + h)/b * N ≥ R Under this condition:

Maximum channel utilization ≈≈ data size/frame size = d/(d + h) Maximum data throughput ≈ d/FS = d/(d + h ) * b

• Including the effect of errors only on data frame; assuming selectiverepeat:

On the average p data frames have to be retransmitted

Under these condition: Total Data Frame overhead = h + p * FS

Maximum channel utilization ≈ d/[(1 + p)*FS]

Maximum data throughput ≈ d/[(1 + p)*FS] * b

EECC694 - ShaabanEECC694 - Shaaban#20 lec #4 Spring2000 3-16-2000

Two Operation Sequences For Sliding Window Protocol (#4)

(a) Normal Protocol Operation: No duplicate packets

(b) A special situation: Half the frames contain duplicates

* Network layer accepts a packet.

EECC694 - ShaabanEECC694 - Shaaban#21 lec #4 Spring2000 3-16-2000

Effect of Errors in Sliding Window ProtocolsEffect of Errors in Sliding Window Protocols

(a) Effect of an error when the receiver size is 1

(b) Effect of an error when the receiver size is large

EECC694 - ShaabanEECC694 - Shaaban#22 lec #4 Spring2000 3-16-2000

Finite State Machine Protocol ModelsFinite State Machine Protocol Models• A protocol may be represented by a finite state machine

(protocol machine).

• States are chosen when the protocol machine is waitingfor the next event (i.e sending or receiving a protocoldata unit PDU).

• The state of the complete protocol is the combination ofthe state of the two protocol machines and the channel.

• The state of the channel depends on its content.

• Each state may have one or more transitions to otherstates when protocol events occur.

• Incomplete state machine specification.

• Deadlock states.

EECC694 - ShaabanEECC694 - Shaaban#23 lec #4 Spring2000 3-16-2000

State Transition Diagram For Protocol 3State Transition Diagram For Protocol 3• The protocol state machine states are represented by XYZ

– X = 0 or 1 depending on the sequence number of the frame thesender is attempting to send.

– Y = 0 or 1 depending on the sequence number of the frame thereceiver expects.

– Z = 0, 1, A or empty (-) corresponding to the state (content) of thechannel.

EECC694 - ShaabanEECC694 - Shaaban#24 lec #4 Spring2000 3-16-2000

Data Link Protocol Example:Data Link Protocol Example: HDLC - High-Level Data Link Control HDLC - High-Level Data Link Control• Bit-oriented protocol derived from IBM’s SNA data link

protocol SDLC (Synchronous Data Link Control).

• Frame Types: Information, Supervisory, Unnumbered.

• Uses sliding window with 3-bit sequence numbers.

• Uses CRC-CCITT for error control.

• Protocol commands include:– DISC (DISConnect) used to disconnect a machine from the line.

– SNRM (Set Normal Response Mode) brings a machine online andsets one machine as channel master and the other as slave ( wasused for dumb terminals when connected to mainframes).

– SABM (Set Asynchronous Balanced Mode).

– FRMR (FRaMe Reject) rejects a frame with correct checksumwith impossible structure.

EECC694 - ShaabanEECC694 - Shaaban#25 lec #4 Spring2000 3-16-2000

HDLC Bit-Oriented Frame FormatHDLC Bit-Oriented Frame Format

Information Frame

Supervisory Frame

Unnumbered Frame

Frame Sequence # Poll/Final Next Frame Expected

EECC694 - ShaabanEECC694 - Shaaban#26 lec #4 Spring2000 3-16-2000

Data Link For Temporary Internet Host ConnectionData Link For Temporary Internet Host Connection

•• Serial Line IP (SLIP).Serial Line IP (SLIP).

•• Point-to-Point Protocol (PPP).Point-to-Point Protocol (PPP).

EECC694 - ShaabanEECC694 - Shaaban#27 lec #4 Spring2000 3-16-2000

Internet Data Link Protocols:Internet Data Link Protocols: Serial Line IP (SLIP) RFC 1055 Serial Line IP (SLIP) RFC 1055• Send raw IP packets with a flag byte (0xC0) at the end

for framing with character stuffing (data 0xC0 replacedwith 0xDB 0xDC).

• Recent versions use header compression by omittingheader fields in consecutive packets and frames.

• Does not include any form of error detection orcorrection.

• Supports only one network protocol: IP (InternetProtocol).

• Dynamic IP address assignment not supported.

• Lacks any form of authentication.

EECC694 - ShaabanEECC694 - Shaaban#28 lec #4 Spring2000 3-16-2000

Internet Data Link Protocols:Internet Data Link Protocols: Point-to-Point Protocol (PPP) Point-to-Point Protocol (PPP)

• Uses standard HDLC framing byte (01111110) with errordetection.

• Uses Link Control Protocol (LCP) for brining lines up, optionnegotiation, and to bring lines down.

• Network layer options and configurations are negotiatedindependent of the network layer used by utilizing differentNCPs (Network Control Protocol) packets for each supportednetwork layer.

• Support for several packet types by using a protocol field:– Network protocols (protocol field starts with 0): IP, IPX,

AppleTalk etc.

– Negotiating protocols (protocol field starts with 1): LCP, NCP.

• PPP is used for both dial-up network access and for router-to-router communication in subnets.

EECC694 - ShaabanEECC694 - Shaaban#29 lec #4 Spring2000 3-16-2000

PPP Frame Format & Transition DiagramPPP Frame Format & Transition Diagram

PPP Frame Format for unnumbered mode operation.

Simplified PPP phase diagram for brining a line up or down.

EECC694 - ShaabanEECC694 - Shaaban#30 lec #4 Spring2000 3-16-2000

PPP Line Control Packet TypesPPP Line Control Packet Types