eighth edition by william stallings chapter 7 – data link control protocols data link control...

24
Eighth Edition Eighth Edition by William Stallings by William Stallings Protocols Protocols Data Data Link Control Link Control Protocols Protocols need layer of logic above Physical need layer of logic above Physical to manage exchange of data over a to manage exchange of data over a link link frame synchronization frame synchronization flow control flow control error control error control addressing addressing control and data control and data link management link management

Post on 20-Dec-2015

234 views

Category:

Documents


0 download

TRANSCRIPT

Eighth EditionEighth Edition

by William Stallingsby William Stallings

Chapter 7 – Chapter 7 – Data Data Link Control ProtocolsLink Control Protocols

Data Data Link Control ProtocolsLink Control Protocols

need layer of logic above Physicalneed layer of logic above Physical to manage exchange of data over a linkto manage exchange of data over a link

frame synchronizationframe synchronization flow controlflow control error controlerror control addressingaddressing control and datacontrol and data link managementlink management

11-1 FRAMING11-1 FRAMING

The data link layer needs to pack bits into The data link layer needs to pack bits into framesframes, so that each , so that each frame is distinguishable from another. Our postal system frame is distinguishable from another. Our postal system practices a type of framing. The simple act of inserting a letter practices a type of framing. The simple act of inserting a letter into an envelope separates one piece of information from into an envelope separates one piece of information from another; the envelope serves as the delimiter. another; the envelope serves as the delimiter.

Figure 11.1 A frame in a character-oriented protocol

Figure 11.2 Byte stuffing and unstuffing

Byte stuffing is the process of adding 1 extra byte whenever there is a flag or escape character in the text.

Figure 11.3 A frame in a bit-oriented protocol

Bit stuffing is the process of adding

one extra 0 whenever five consecutive 1s follow a 0 in the data, so that the

receiver does not mistake the pattern 0111110 for a flag.

Figure 11.4 Bit stuffing and unstuffing

FLOW AND FLOW AND ERROR ERROR CONTROLCONTROL

Flow control refers to a set of procedures used to restrict the amount of data that the sender

can send before waiting for

acknowledgment.

Error control in the data link layer is

based on automatic repeat request, which is the retransmission

of data.

ensure sending entity does not ensure sending entity does not overwhelm receiving entityoverwhelm receiving entity by preventing buffer overflowby preventing buffer overflow

influenced by:influenced by: transmission timetransmission time

• time taken to emit all bits into time taken to emit all bits into mediummedium

propagation timepropagation time• time for a bit to traverse the time for a bit to traverse the

linklink assume here no errors but varying assume here no errors but varying

delaysdelays

Flow ControlFlow Control

The most important responsibilities of the The most important responsibilities of the data link layer are flow control and error data link layer are flow control and error control. Collectively, these functions are control. Collectively, these functions are known as data link control.known as data link control.

11-3 PROTOCOLS11-3 PROTOCOLS

Now let us see how the data link layer can combine framing, flow Now let us see how the data link layer can combine framing, flow control, and error control to achieve the delivery of data from one node control, and error control to achieve the delivery of data from one node to another. The protocols are normally implemented in software by to another. The protocols are normally implemented in software by using one of the common programming languages. using one of the common programming languages.

11-4 NOISELESS CHANNELS11-4 NOISELESS CHANNELS

Let us first assume we have an ideal channel in which no frames are Let us first assume we have an ideal channel in which no frames are lost, duplicated, or corrupted. We introduce two protocols for this type lost, duplicated, or corrupted. We introduce two protocols for this type of channel.of channel.

Model of Model of Frame Frame TransmisTransmissionsion

Stop and WaitStop and Wait

source transmits framesource transmits frame destination receives destination receives

frame and replies with frame and replies with acknowledgement (ACK)acknowledgement (ACK)

source waits for ACK source waits for ACK before sending nextbefore sending next

destination can stop flow destination can stop flow by not send ACKby not send ACK

works well for a few large works well for a few large framesframes

Stop and wait becomes Stop and wait becomes inadequate if large block inadequate if large block of data is split into small of data is split into small framesframes

Stop and Wait Link UtilizationStop and Wait Link Utilization

Utilization under SW Flow ControlUtilization under SW Flow Control

Utilization = U = frame time / total timeUtilization = U = frame time / total time U = 1/1+2aU = 1/1+2a a = Propagation Time / Transmission Timea = Propagation Time / Transmission Time a = Mediuma = Medium length in bits / Frame length in length in bits / Frame length in

bitsbits Station s1 sends f1Station s2 sends an acknowledgmentStation s1 sends f2Station s2 sends an acknowledgment...Station s1 sends fnStation s2 sends an acknowledgment

CALCULATION OF U

Total time to send the data=T=nTTotal time to send the data=T=nTff

TTff=time to send and receive an acknowledgment=time to send and receive an acknowledgment Tf=TTf=Tframeframe+T+Tpropprop+Tproc+ T+Tproc+ Tackack + T + Tpropprop+T+Tprocproc

TTpropprop=propagation time from s1 to s2=propagation time from s1 to s2 TTframeframe=time to transmit a frame=time to transmit a frame TTprocproc=processing time (negligible)=processing time (negligible) TTackack=time to transmit an acknowledgment(very small as =time to transmit an acknowledgment(very small as

compared to data frame)compared to data frame) T=2TT=2Tpropprop+T+Tframeframe

For n frames For n frames T=n(2TT=n(2Tpropprop+T+Tframeframe)) Of that time only n x Tframe is actually spent transmitting data Of that time only n x Tframe is actually spent transmitting data

and the rest is overhead,therefore the utilization or efficiency of and the rest is overhead,therefore the utilization or efficiency of the line isthe line is

U= (n x TU= (n x Tframeframe )/n(2T )/n(2Tpropprop+T+Tframeframe)) = T= Tframeframe/(2T/(2Tpropprop+T+Tframeframe)) If If a=Ta=Tpropprop/T/Tframeframe then then U=1/(1+2a)U=1/(1+2a)

CALCULATION OF UCALCULATION OF U

Utilization with Sliding Window Flow Utilization with Sliding Window Flow ControlControl

N > 2a + 1 N > 2a + 1

forfor

N < 2a + 1N < 2a + 1

forforN

2a + 1U =

U = 1

Sliding Windows Flow ControlSliding Windows Flow Control allows multiple numbered frames to be in transitallows multiple numbered frames to be in transit receiver has buffer W longreceiver has buffer W long transmitter sends up to W frames without ACKtransmitter sends up to W frames without ACK ACK includes number of next frame expectedACK includes number of next frame expected sequence number is bounded by size of field (k)sequence number is bounded by size of field (k)

frames are numbered modulo 2frames are numbered modulo 2kk

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

further transmission (Receive Not Ready)further transmission (Receive Not Ready) must send a normal acknowledge to resumemust send a normal acknowledge to resume if have full-duplex link, can piggyback ACksif have full-duplex link, can piggyback ACks

Sliding Window DiagramSliding Window Diagram

Sliding Window ExampleSliding Window Example

Error ControlError Control detection and correction of errors such as:detection and correction of errors such as:

lost frameslost frames damaged framesdamaged frames

common techniques use:common techniques use: error detectionerror detection positive acknowledgmentpositive acknowledgment retransmission after timeoutretransmission after timeout negative acknowledgement & retransmissionnegative acknowledgement & retransmission

Automatic Repeat Request Automatic Repeat Request (ARQ)(ARQ)

collective name for such error control collective name for such error control mechanisms, including:mechanisms, including:

stop and waitstop and wait go back Ngo back N selective reject (selective retransmission)selective reject (selective retransmission)

Stop and WaitStop and Wait

pros and conspros and cons simplesimple inefficientinefficient

source transmits single source transmits single frameframe

wait for ACKwait for ACK if received frame if received frame

damaged, discard itdamaged, discard it transmitter has timeouttransmitter has timeout if no ACK within timeout, if no ACK within timeout,

retransmitretransmit if ACK if ACK

damaged,transmitter will damaged,transmitter will not recognize itnot recognize it

transmitter will retransmittransmitter will retransmit receive gets two copies of receive gets two copies of

frameframe use alternate numbering use alternate numbering

and ACK0 / ACK1and ACK0 / ACK1

Go Back NGo Back N based on sliding windowbased on sliding window if no error, ACK as usualif no error, ACK as usual use window to control number of outstanding framesuse window to control number of outstanding frames if error, reply with rejectionif error, reply with rejection

discard that frame and all future frames until error frame discard that frame and all future frames until error frame received correctlyreceived correctly

transmitter must go back and retransmit that frame and all transmitter must go back and retransmit that frame and all subsequent framessubsequent frames

Damaged FrameDamaged Frame error in frame error in frame i i so receiver rejects frame so receiver rejects frame i i transmitter retransmits frames from transmitter retransmits frames from ii

Lost FrameLost Frame frame frame ii lost and either lost and either

• transmitter sends transmitter sends i+1 i+1 andand receiver gets frame receiver gets frame i+1i+1 out of seq and out of seq and rejects frame rejects frame i i

• or transmitter times out and send ACK with P bit set which receiver or transmitter times out and send ACK with P bit set which receiver responds to with ACK responds to with ACK i i

transmitter then retransmits frames from i transmitter then retransmits frames from i

Go Back N Go Back N

DiagramDiagram

Go Back N - HandlingGo Back N - Handling

Damaged AcknowledgementDamaged Acknowledgement receiver gets frame receiver gets frame ii, sends ack (, sends ack (i+1i+1) which is lost) which is lost acks are cumulative, so next ack (acks are cumulative, so next ack (i+ni+n) may arrive ) may arrive

before transmitter times out on frame before transmitter times out on frame ii if transmitter times out, it sends ack with P bit setif transmitter times out, it sends ack with P bit set can be repeated a number of times before a reset can be repeated a number of times before a reset

procedure is initiatedprocedure is initiated Damaged RejectionDamaged Rejection

reject for damaged frame is lostreject for damaged frame is lost handled as for lost frame when transmitter times outhandled as for lost frame when transmitter times out

Selective RejectSelective Reject

also called selective retransmissionalso called selective retransmission only rejected frames are retransmittedonly rejected frames are retransmitted subsequent frames are accepted by the receiver subsequent frames are accepted by the receiver

and bufferedand buffered minimizes retransmissionminimizes retransmission receiver must maintain large enough bufferreceiver must maintain large enough buffer more complex logic in transmittermore complex logic in transmitter hence less widely usedhence less widely used useful for satellite links with long propagation useful for satellite links with long propagation

delaysdelays

SelectiveSelective-Reject-RejectDiagramDiagram

Selective Selective Reject Reject DiagramDiagram