Presentation on theme: "William Stallings Data and Computer Communications 7th Edition"— Presentation transcript:
1 William Stallings Data and Computer Communications 7th Edition Chapter 7Data Link Control Protocols
2 Data Link Control Protocol (DLCP) DLCP is a layer of logic above the physical layer used to control the sending of data over a data communication link.Requirements and objectives of data link control:Frame synchronization: to recognize beginning and end of the frame.Flow control: can't send frames faster than the receiver can handle.Error control: correct data should be delivered.Addressing: on multipoint line, identify the destination.Control and data on same link.Link management: initiation, maintenance, and termination of data exchange.
3 Flow ControlThe receiver must do a certain amount of processing before passing the data to the higher-level software.Flow control technique ensures that sending entity does not overwhelm the receiving entity with dataPreventing buffer overflowTransmission timeTime taken to emit all bits of a frame onto the medium.Proportional to the length of the frame.Propagation timeTime for a bit to traverse the link between source and destination.
5 Stop and Wait Flow Control The simplest form of flow control, is stop-and-wait:Source transmits frameDestination receives frame and replies with acknowledgement signal.Source waits for ACK before sending next frame.If an error occurs, destination can stop flow by not send ACK signal.Works well for a few large framesFew waiting times for ACK.
6 FragmentationLarge block of data may be split into small frames, due to:Limited buffer size on the receiver.With smaller frames, errors detected sooner (when whole frame received)On error, retransmission of smaller frames is needed (better)Prevents one station from occupying a shared medium for long periodsStop and wait becomes inadequate, with the use of multiple frames for a single message.Only one frame at a time can be in transit.
7 Link utilization Bit length of a link: B = number of bits present on the link when a stream of bits fully occupies the link.R = data rate of the link, in bps.d = length, or distance, of the link in meters.V = velocity of propagation, in m/s.In situations where the bit length of the link is greater that the frame, serious inefficiencies result.
8 Stop and Wait Link Utilization Figure 7.2 Stop-and-wait link utilization (transmission time = 1; propagation time = a)
9 Sliding-Window Flow Control The essence of the problem in the stop-and-wait, is that only one frame at a time can be in transit.Sliding-window allows multiple frames to be in transit at the same time.Receiver has buffer (window) space for W frames.Transmitter can send up to W frames without ACK.To keep track of which frames have been acknowledged, each frame has a sequence number.ACK includes sequence number of next frame expectedSequence number bounded by size of field (k bits)Range of sequence numbers is 0 through 2k – 1.Window size is needed to be less than 2k.
12 Sliding Window Enhancements Receiver can acknowledge frames without permitting further transmission Receive Not Ready (RNR)Must send a normal acknowledge to resumeIf two stations exchange data, each needs to maintain two windows, one for transmit and one for receive.Each side needs to send the data and ACK to the other.To provide efficient support, use piggybackingEach data frame includes a field that holds a sequence number of the frame plus a sequence number used for ACK.If no data to send, use acknowledgement frameIf data but no acknowledgement to send, send last acknowledgement number again.
13 Error ControlError control refers to both functions of detection and correction of errors.Possibility of two types of errors:Lost frames: a frame fails to arrive to the destination.Damaged frames: bit error.Components of error control techniques:Error detectionPositive acknowledgment for error-free frames.Retransmission after timeout (in case of lost frames)Negative acknowledgement and retransmission for frames received with errors
14 Error DetectionAdditional bits added by transmitter for error detection codeParityValue of parity bit is such that character has even (even parity) or odd (odd parity) number of ones.Even number of bit errors goes undetectedCyclic Redundancy Check (CRC)For a block of k bits transmitter generates n bit sequence, known as frame check sequence (FCS).Transmit k+n bits which is exactly divisible by some numberReceiver divides frame by that number, if no remainder, assume no error
15 Cyclic Redundancy Check T = n-bit frame to be transmitted.D = k-bit block of data, or message, the first k bits of T.F = (n-k)-bit FCS, the last (n-k) bits of T.P = pattern of n-k+1 bits; this is the predetermined divisor.We would like T/P to have no remainder. It should be clear that: T = 2n-kD+F
16 CRC Example Given: Thus, n = 15, k = 10, and (n-k) = 5. Message D = (10-bits)Pattern P = (6-bits)FCS R = to be calculated (5 bits)Thus, n = 15, k = 10, and (n-k) = 5.The message is multiplied by 25, yieldingThis product is divided by P, remainder R =R is added to 25D to give T = , which is transmitted.On the receiver, the received frame is divided by P, if R=0 then it is assumed that there have been no errors.
17 Error Control Mechanisms: Automatic Repeat Request (ARQ) The effect of ARQ is to turn an unreliable data link into reliable one.Three versions of ARQ have been standardized:Stop-and-wait ARQGo-back-N ARQSelective-reject ARQ
18 Stop and Wait Based on stop-and-wait flow control technique. Source transmits single frame and then waits for ACK.Tow sorts of errors could occur:Frame that arrives at the destination could be damagedTransmitter has timeoutIf no ACK within timeout, retransmitIf ACK damaged, transmitter will not recognize itTransmitter will retransmitReceiver gets two copies of frameTo avoid duplication, frames are alternately labeled with 0 or 1. Use ACK0 and ACK1Advantage: simplicity.Disadvantage: inefficient line use.
20 Go-Back-N ARQ Based on sliding-window flow control. The number of unacknowledged frames outstanding is determined by window size.If no error, the destination will ACK incoming frames as usual with (RR = receive ready)If the destination detects an error, send a negative ACK (REJ = rejection); explained as follows:Discard that frame and all future frames until the error frame received correctlyWhen the transmitter receives a REJ, it must go back and retransmit that frame and all subsequent frames
21 Go-Back-N Contingencies: 1. Damaged Frame Frame received with errorReceiver detects an error in frame iReceiver sends REJ iTransmitter gets REJ iTransmitter retransmits frame i and all subsequentLost Frame (same as Damaged REJ)Frame i lostTransmitter sends i+1Receiver gets frame i+1 out of sequenceReceiver send REJ i
22 Go-Back-N - Lost Frame (Last frame) Frame i lost and no additional frame sent (frame i last frame).Receiver gets nothing and returns neither ACK nor REJ.Transmitter times out and sends ACK frame with that includes a bit known as P bit set to 1.Receiver interprets this as command which it acknowledges with the number of the next frame it expects (frame i ).Transmitter then retransmits frame i.
23 Go-Back-N Contingencies : 2. Damaged RR Receiver gets frame i and send RR (i+1) which is lost.Acknowledgements are cumulative, e.g. RR 6 means that all frames through 5 are acknowledged.Transmitter may receive a subsequent RR > RR (i+1) before the timer associated with frame i expires.If transmitter times out, it sends acknowledgement with P bit set as before.This can be repeated a number of times before a reset procedure is initiated.
24 Go-Back-N Diagram In this example 3-bit sequence number field is used. Maximum window size = 23-1 = 7.
25 Selective Reject Also called selective retransmission Only rejected (negative acknowledged SREJ) frames are retransmitted, or those that time out.Subsequent frames are accepted by the receiver and bufferedAdvantage:More efficient than go-back-N because it minimizes retransmission.Disadvantages:Receiver must maintain large enough bufferMore complex logic to be able to send s frame out of sequence.
27 High Level Data Link Control (HDLC) The most important data link control protocol.ISO 33009, ISO 4335It is widely used.It is the basis for many other important data link control protocols.To satisfy a variety of applications, HDLC defines three types of stations, two link configurations, and three data transfer modes of operation.
28 Basic characteristics of HDLC: 1. Station Types Primary stationControls operation of linkFrames issued by primary station are called commandsMaintains separate logical link to each secondary stationSecondary stationUnder control of primary stationFrames issued called responsesCombined stationMay issue commands and responses
29 Basic characteristics of HDLC: 2. HDLC Link Configurations Unbalanced ConfigurationsConsists of one primary and one or more secondary stationsSupports full duplex and half duplex transmissionBalanced ConfigurationsConsists of two combined stationsSupports full duplex and half duplex
30 HDLC Data Transfer Modes (I) Normal Response Mode (NRM)Unbalanced configurationPrimary initiates data transfer to secondarySecondary may only transmit data in response to command from primaryUsed on multi-drop lines, where host computer as primary and terminals as secondary
31 HDLC Data Transfer Modes (II) Asynchronous Balanced Mode (ABM)Balanced configuration (two combined stations)Either station may initiate transmission without receiving permission from the other combined station.Most widely used;It makes more efficient use of a full-duplex point-to-point link because there is no polling overhead
32 HDLC Data Transfer Modes (III) Asynchronous Response Mode (ARM)Unbalanced configurationSecondary may initiate transmission without explicit permission from primaryPrimary responsible for linerarely used
33 HDLC Frame Structure HDLC uses Synchronous transmission All transmissions in framesSingle frame format for all types data and control exchanges
35 Flag FieldsFlag fields delimit frame at both ends with a unique patternA single flag may close one frame and open anotherReceiver hunts for flag sequence to synchronizeBit stuffing used to avoid confusion with data containing0 inserted after every sequence of five 1sIf receiver detects five 1s it checks next bitIf 0, it is deletedIf 1 and seventh bit is 0, accept as flagIf sixth and seventh bits 1, sender is indicating abort
36 Bit Stuffing Example with possible error (a) bit stuffing (b) 1-bit error splits it in two.(c) 1-bit error merges two frames into one.
37 Address FieldIdentifies secondary station that sent or will receive frameUsually 8 bits long, but may be extended to multiples of 7 bitsLSB of each octet indicates that it is the last octet (1) or not (0)All ones ( ) is broadcast
38 Control FieldFirst one or two bits of control filed identify frame typeCan identify three types:Information frames: data to be transmitted to user (next layer up)Flow and error control are piggybacked on information framesSupervisory frames: provide the ARQ mechanism when piggybacking not used.Unnumbered frames: supplementary link controlP/F:In command frames (P bit): set to 1 to solicit a response frame from a peer HDLC entity.In response frames (F bits): set to 1 to indicate the response frame transmitted as a result of a soliciting command.
40 Information and FCS Fields Information field:Present only in information and some unnumbered framesMust contain an integral number of octetsVariable length up to some system-define maximum.FCS field:Error detection detecting code calculated from the remaining bits of the frame (exclusive of flags)16 bit CRCOptional 32 bit CRC, depends to line reliability.
41 HDLC OperationHDLC operation consists of the exchange of information, supervisory and unnumbered framesThe operation involves three phasesInitialization: one side initializes the data link to exchange frames in an orderly fashion.Data transfer: exchange user data and control information.Disconnect: termination of the operation.
42 Some HDLC commands and responses Information (I) C/RSupervisory (S)Receive ready (RR) C/RReceive not ready (RNR) C/RReject (REJ) C/RSelective reject (SREJ) C/RUnnumbered (U)Set asynchronous balanced/extend mode (SABM/SABME) CDisconnect (DISC) CUnnumbered acknowledgment (UA) R