Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data and Computer Communications Data Link Control Protocols.

Similar presentations


Presentation on theme: "Data and Computer Communications Data Link Control Protocols."— Presentation transcript:

1 Data and Computer Communications Data Link Control Protocols

2  Need a logical layer above physical layer  To manage exchange of data over a link Frame synchronization Frame synchronization Flow control Flow control Error control Error control Addressing Addressing Control and data on same link Control and data on same link Link management Link management

3 Flow Control  Ensure sending entity does not overwhelm receiving entity By preventing buffer overflow By preventing buffer overflow  Influenced by: Transmission time Transmission time Time taken to emit all bits into mediumTime taken to emit all bits into medium Propagation time Propagation time Time for a bit to traverse the linkTime for a bit to traverse the link  Assume here no errors but varying delays

4 Model of Frame Transmission

5 Stop and Wait  Source transmits frame  Destination receives frame and replies with acknowledgement (ACK)  Source waits for ACK before sending next  Destination can stop flow by not sending ACK  Works well for a few large frames  Becomes inadequate if large block of data is split into small frames

6 Bit length of a link: B = R x d/V where: B = Length of the link in bits; the no. of bits present on the link at an instance in time when a stream of bits fully occupies the link R = Data Rate of the link in bps d = Length of the link in meters V = Velocity of propagation Define: a = B/L (L = number of bits in the frame) a<1 : Propagation time < Transmission time a>1 : Propagation time > Transmission time

7 Stop and Wait: Performance  Aim: Determine maximum potential efficiency of a half-duplex point-to-point line using the stop-and-wait scheme  Example: Long message sent as a sequence of frames F 1, F 2, …., F n Station S 1 sends F 1. Station S 1 sends F 1. Station S 2 sends an acknowledgment. Station S 2 sends an acknowledgment. Station S 1 sends F 2. Station S 1 sends F 2. Station S 2 sends an acknowledgment. Station S 2 sends an acknowledgment. Station S 1 sends F n. Station S 1 sends F n. Station S 2 sends an acknowledgment. Station S 2 sends an acknowledgment.

8 Stop and Wait: Performance  Total time to send the data, T, can be expressed as T = nT F, where T F is the time to send one frame and receive an acknowledgment. T F = t prop + t frame + t proc + t prop + t ack + t proc Where: Where: t prop = propagation time from S 1 to S 2 t prop = propagation time from S 1 to S 2 t frame = time to transmit a frame (time for the transmitter to send out all of the bits of the frame) t frame = time to transmit a frame (time for the transmitter to send out all of the bits of the frame) t proc = processing time at each station to react to an incoming event t proc = processing time at each station to react to an incoming event t ack = time to transmit an acknowledgment t ack = time to transmit an acknowledgment

9 Stop and Wait: Performance  Assumptions: Processing time is relatively negligible Processing time is relatively negligible Acknowledgment frame is very small compared to a data frame Acknowledgment frame is very small compared to a data frame  We obtain: T = n (2t prop + t frame )  Only (n x t frame ) is actually spent transmitting data and the rest is overhead.  The utilization, or efficiency, of the line is:

10 Stop and Wait: Performance  Parameter a:a = t prop / t frame  Then:  This is the maximum possible utilization of the link.  Again,  Propagation time = distance d of the link divided by the velocity V of propagation  Transmission time = length of frame in bits, L, divided by the data rate R  Therefore,

11 Stop and Wait: Link Utilization

12 Sliding Window Flow Control  Allows multiple numbered frames to be in transit  Receiver has buffer of length W  Transmitter sends up to W frames without ACK  ACK includes sequence no. of next frame expected  Sequence number is bounded by size of field (k) frames are numbered modulo 2 k frames are numbered modulo 2 k giving max window size of up to 2 k - 1 giving max window size of up to 2 k - 1  Receiver can ACK frames without permitting further transmission (Receiver Not Ready)  Must send a normal ACK to resume  If the link is full-duplex, ACKs can be piggybacked

13 Sliding Window Diagram

14 Sliding Window Example

15 Error Free Sliding Window: Performance  Station A begins to emit a sequence of frames at time t = 0.  The leading edge of the first frame reaches station B at t = a.  The first frame is entirely absorbed by t = a+1  Assume: Negligible processing time, B can immediately acknowledge the first frame (ACK)  Assume: The acknowledgment frame is so small that transmission time is negligible  ACK reaches A at t = 2a+1

16 Error Free Sliding Window: Performance  Case 1: W ≥ 2a + 1 Acknowledgment for frame 1 reaches A before A has exhausted its window. Acknowledgment for frame 1 reaches A before A has exhausted its window. A can transmit continuously with no pause and normalized throughput is 1.0. A can transmit continuously with no pause and normalized throughput is 1.0.  Case 2: W < 2a + 1 A exhausts its window at t = W and cannot send additional frames until t = 2a+1 A exhausts its window at t = W and cannot send additional frames until t = 2a+1 Normalized throughput is W time units out of a period of (2a+1) time units Normalized throughput is W time units out of a period of (2a+1) time units

17 Error Free Sliding Window: Link Utilization  Utilization is expressed as:

18 Error Free Sliding Window: Link Utilization

19

20

21 Error Control  Detection and correction of errors such as: Lost frames Lost frames Damaged frames Damaged frames  Common techniques use: Error detection Error detection Positive acknowledgment Positive acknowledgment Retransmission after timeout Retransmission after timeout Negative acknowledgement & retransmission Negative acknowledgement & retransmission

22 Automatic Repeat Request (ARQ)  ARQ – Collective name for such error control mechanisms.  Versions include:  Stop-and-wait ARQ  Go-back-N ARQ  Selective-reject ARQ

23 Stop-and-Wait ARQ  Source transmits single frame  Waits for ACK  Damaged frame Receiver rejects frame Receiver rejects frame Transmitter has timeout Transmitter has timeout If no ACK within timeout, retransmit If no ACK within timeout, retransmit  Damaged ACK Transmitter does not recognize, retransmits Transmitter does not recognize, retransmits Receiver gets two copies of frame Receiver gets two copies of frame Uses alternate numbering for ACKs to distinguish: ACK0 and ACK1 Uses alternate numbering for ACKs to distinguish: ACK0 and ACK1

24 Stop and Wait  Example: Both types of errors  Pros and cons Simple Simple Inefficient Inefficient

25 Stop and Wait: Performance  With no errors, max. utilization = 1/(1+2a)  Aim: Determine utilization with possibility that frames are repeated due to bit errors.  For error-free operation using stop-and-wait ARQ, where, T p is the propagation time where, T p is the propagation time

26  If error occurs, where N r is the expected no. of transmissions of a frame.  Since T t / T f = (1+2a), we obtain: we obtain:  Probability that it will take exactly k attempts to transmit a frame successfully: P k-1 (1-P) P is the probability that a single frame is in error P is the probability that a single frame is in error Stop and Wait: Performance

27  Therefore, for Stop-and-Wait,

28 Go-Back-N ARQ  Based on sliding window  If no error, ACK as usual  Use window to control number of outstanding frames  If error, reply with rejection Discard that frame and all future frames until error frame received correctly Discard that frame and all future frames until error frame received correctly Transmitter must go back and retransmit that frame and all subsequent frames Transmitter must go back and retransmit that frame and all subsequent frames

29 Go-Back-N ARQ – Details  Damaged Frame Error in frame i so receiver rejects frame i Error in frame i so receiver rejects frame i Transmitter retransmits frames from i Transmitter retransmits frames from i  Lost Frame Frame i lost and either Frame i lost and either Transmitter sends i+1 and receiver gets frame i+1 out of seq and rejects frame iTransmitter sends i+1 and receiver gets frame i+1 out of seq and rejects frame i Or transmitter times out and send ACK with P bit set, which receiver responds to with ACK iOr transmitter times out and send ACK with P bit set, which receiver responds to with ACK i Transmitter then retransmits frames from i Transmitter then retransmits frames from i

30  Damaged Acknowledgement Receiver gets frame i, sends ACK (i+1) which is lost Receiver gets frame i, sends ACK (i+1) which is lost ACKs are cumulative, so next ACK (i+n) may arrive before transmitter times out on frame i ACKs are cumulative, so next ACK (i+n) may arrive before transmitter times out on frame i If transmitter times out, it sends ACK with P bit set If transmitter times out, it sends ACK with P bit set Can be repeated a number of times before a reset procedure is initiated Can be repeated a number of times before a reset procedure is initiated  Damaged Rejection Reject for damaged frame is lost Reject for damaged frame is lost Handled as for lost frame when transmitter times out Handled as for lost frame when transmitter times out Go-Back-N ARQ – Details

31 Go-Back-N ARQ: Performance  Each error generated a requirement to retransmit K frames rather than 1 frame. where f(i) is the total no. of frames transmitted if the original frame must be transmitted i times

32 Go-Back-N ARQ: Performance  K = (2a + 1) for W ≥ (2a + 1)  K = W for W < (2a + 1)

33 Go-Back-N ARQ: Link Utilization

34 Selective Reject ARQ  Also called selective retransmission  Only rejected frames are retransmitted  Subsequent frames are accepted by the receiver and buffered  Minimizes retransmission  Receiver must maintain large enough buffer  More complex logic in transmitter  Hence less widely used  Useful for satellite links with long propagation delays

35 Go-Back-N vs Selective Reject

36 Selective Reject: Link Utilization  Same reasoning as for Stop-and-Wait ARQ  N r = 1 / (1 – P)

37 Comparative Link Utilization  ARQ Utilization as a function of a (P = 10 -3 )

38 High Level Data Link Control (HDLC)  An important data link control protocol  Specified as ISO 33009, ISO 4335  Station types: Primary - controls operation of link Primary - controls operation of link Secondary - under control of primary station Secondary - under control of primary station Combined - issues commands and responses Combined - issues commands and responses  Link configurations Unbalanced - 1 primary, multiple secondary Unbalanced - 1 primary, multiple secondary Balanced - 2 combined stations Balanced - 2 combined stations

39 HDLC Transfer Modes  Normal Response Mode (NRM) Unbalanced config., primary initiates transfer Unbalanced config., primary initiates transfer Used on multi-drop lines, e.g. host + terminals Used on multi-drop lines, e.g. host + terminals  Asynchronous Balanced Mode (ABM) Balanced config., either station initiates transmission, has no polling overhead, widely used Balanced config., 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 Unbalanced config., secondary may initiate transmit without permission from primary, rarely used

40 HDLC Frame Structure  Synchronous transmission of frames  Single frame format used

41 Flag Fields and Bit Stuffing  Delimit frame at both ends with 01111110 seq.  Receiver hunts for flag sequence to synchronize  Bit stuffing used to avoid confusion with data containing flag seq 01111110 0 inserted after every sequence of five 1s 0 inserted after every sequence of five 1s If receiver detects five 1s it checks next bit If receiver detects five 1s it checks next bit If next bit is 0, it is deleted (was stuffed bit) If next bit is 0, it is deleted (was stuffed bit) If next bit is 1 and seventh bit is 0, accept as flag If next bit is 1 and seventh bit is 0, accept as flag If sixth and If sixth and seventh bits 1, seventh bits 1, sender is sender is indicating abort indicating abort

42 Address Field  Identifies secondary station that sent or will receive frame  Usually 8 bits long  May be extended to multiples of 7 bits LSB indicates if is the last octet (1) or not (0) LSB indicates if is the last octet (1) or not (0)  All ones address 11111111 is broadcast

43 Control Field  Different for different frame type Information - data transmitted to user (next layer up) Information - data transmitted to user (next layer up) Flow and error control piggybacked on information framesFlow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control Unnumbered - supplementary link control  First 1-2 bits of control field identify frame type

44 Control Field  Use of Poll/Final bit depends on context  In command frame, is P bit set to1 to solicit (poll) response from peer  In response frame, is F bit set to 1 to indicate response to soliciting command  Seq. number usually 3 bits can extend to 8 bits as shown below can extend to 8 bits as shown below

45 Information & FCS Fields  Information Field In information and some unnumbered frames In information and some unnumbered frames Must contain integral number of octets Must contain integral number of octets Variable length Variable length  Frame Check Sequence Field (FCS) Used for error detection Used for error detection Either 16 bit CRC or 32 bit CRC Either 16 bit CRC or 32 bit CRC

46 HDLC Operation  Consists of exchange of information, supervisory and unnumbered frames.  Have three phases: Initialization Initialization By either side, set mode & seq.By either side, set mode & seq. Data transfer Data transfer With flow and error controlWith flow and error control Using both I & S-frames (RR, RNR, REJ, SREJ)Using both I & S-frames (RR, RNR, REJ, SREJ) Disconnect Disconnect When ready or fault notedWhen ready or fault noted

47 HDLC Operation Example

48 HDLC Operation Example – Contd.

49 Summary  Introduced need for data link protocols  Flow control  Error control  HDLC


Download ppt "Data and Computer Communications Data Link Control Protocols."

Similar presentations


Ads by Google