Data and Computer Communications Data Link Control Protocols

  • Slides: 49
Download presentation
Data and Computer Communications Data Link Control Protocols

Data and Computer Communications Data Link Control Protocols

Data Link Control Protocols Ø Need a logical layer above physical layer Ø To

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

Flow Control Ø Ensure sending entity does not overwhelm receiving entity l By preventing

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

Model of Frame Transmission

Model of Frame Transmission

Stop and Wait Ø Source transmits frame Ø Destination receives frame and replies with

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

Bit length of a link: B = R x d/V where: B = Length

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

Stop and Wait: Performance Ø Aim: Determine maximum potential efficiency of a half-duplex point-to-point

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, …. , Fn l l l Station S 1 sends F 1. Station S 2 sends an acknowledgment. Station S 1 sends F 2. Station S 2 sends an acknowledgment. Station S 1 sends Fn. Station S 2 sends an acknowledgment.

Stop and Wait: Performance Ø Total time to send the data, T, can be

Stop and Wait: Performance Ø Total time to send the data, T, can be expressed as T = n. TF, where TF is the time to send one frame and receive an acknowledgment. TF = tprop + tframe + tproc + tprop + tack + tproc Where: l l tprop = propagation time from S 1 to S 2 tframe = time to transmit a frame (time for the transmitter to send out all of the bits of the frame) tproc = processing time at each station to react to an incoming event tack = time to transmit an acknowledgment

Stop and Wait: Performance Ø Assumptions: l l Ø Processing time is relatively negligible

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

Stop and Wait: Performance Parameter a: a = tprop / tframe Ø Then: Ø

Stop and Wait: Performance Parameter a: a = tprop / tframe Ø 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, Ø

Stop and Wait: Link Utilization

Stop and Wait: Link Utilization

Sliding Window Flow Control Allows multiple numbered frames to be in transit Ø Receiver

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) Ø l l frames are numbered modulo 2 k 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 Ø

Sliding Window Diagram

Sliding Window Diagram

Sliding Window Example

Sliding Window Example

Error Free Sliding Window: Performance Station A begins to emit a sequence of frames

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 = 2 a+1 Ø

Error Free Sliding Window: Performance Ø Case 1: W ≥ 2 a + 1

Error Free Sliding Window: Performance Ø Case 1: W ≥ 2 a + 1 l l 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. Ø Case 2: W < 2 a + 1 l l A exhausts its window at t = W and cannot send additional frames until t = 2 a+1 Normalized throughput is W time units out of a period of (2 a+1) time units

Error Free Sliding Window: Link Utilization Ø Utilization is expressed as:

Error Free Sliding Window: Link Utilization Ø Utilization is expressed as:

Error Free Sliding Window: Link Utilization

Error Free Sliding Window: Link Utilization

Error Free Sliding Window: Link Utilization

Error Free Sliding Window: Link Utilization

Error Free Sliding Window: Link Utilization

Error Free Sliding Window: Link Utilization

Error Control Ø Detection and correction of errors such as: l l Lost frames

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

Automatic Repeat Request (ARQ) Ø ARQ – Collective name for such error control mechanisms.

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

Stop-and-Wait ARQ Source transmits single frame Ø Waits for ACK Ø Damaged frame l

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

Stop and Wait Ø Example: Both types of errors Ø Pros and cons l

Stop and Wait Ø Example: Both types of errors Ø Pros and cons l l Simple Inefficient

Stop and Wait: Performance With no errors, max. utilization = 1/(1+2 a) Ø Aim:

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

Stop and Wait: Performance Ø If error occurs, where Nr is the expected no.

Stop and Wait: Performance Ø If error occurs, where Nr is the expected no. of transmissions of a frame. Ø Since Tt / Tf = (1+2 a), we obtain: Ø Probability that it will take exactly k attempts to transmit a frame successfully: Pk-1(1 -P) l P is the probability that a single frame is in error

Stop and Wait: Performance Ø Therefore, for Stop-and-Wait,

Stop and Wait: Performance Ø Therefore, for Stop-and-Wait,

Go-Back-N ARQ Ø Based on sliding window Ø If no error, ACK as usual

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 l l Discard that frame and all future frames until error frame received correctly Transmitter must go back and retransmit that frame and all subsequent frames

Go-Back-N ARQ – Details Ø Damaged Frame l l Error in frame i so

Go-Back-N ARQ – Details Ø Damaged Frame l l Error in frame i so receiver rejects frame i Transmitter retransmits frames from i Ø Lost Frame l Frame i lost and either • Transmitter 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 i l Transmitter then retransmits frames from i

Go-Back-N ARQ – Details Ø Damaged Acknowledgement l l Ø Receiver gets frame i,

Go-Back-N ARQ – Details Ø Damaged Acknowledgement l l Ø 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 If transmitter times out, it sends ACK with P bit set Can be repeated a number of times before a reset procedure is initiated Damaged Rejection l l Reject for damaged frame is lost Handled as for lost frame when transmitter times out

Go-Back-N ARQ: Performance Ø Each error generated a requirement to retransmit K frames rather

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

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

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

Go-Back-N ARQ: Link Utilization

Go-Back-N ARQ: Link Utilization

Selective Reject ARQ Also called selective retransmission Ø Only rejected frames are retransmitted Ø

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 Ø

Go-Back-N vs Selective Reject

Go-Back-N vs Selective Reject

Selective Reject: Link Utilization Ø Same reasoning as for Stop-and-Wait ARQ Ø Nr =

Selective Reject: Link Utilization Ø Same reasoning as for Stop-and-Wait ARQ Ø Nr = 1 / (1 – P)

Comparative Link Utilization Ø ARQ Utilization as a function of a (P = 10

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

High Level Data Link Control (HDLC) Ø An important data link control protocol Ø

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

HDLC Transfer Modes Ø Normal Response Mode (NRM) l l Ø Asynchronous Balanced Mode

HDLC Transfer Modes Ø Normal Response Mode (NRM) l l Ø Asynchronous Balanced Mode (ABM) l Ø Unbalanced config. , primary initiates transfer Used on multi-drop lines, e. g. host + terminals Balanced config. , either station initiates transmission, has no polling overhead, widely used Asynchronous Response Mode (ARM) l Unbalanced config. , secondary may initiate transmit without permission from primary, rarely used

HDLC Frame Structure Ø Synchronous transmission of frames Ø Single frame format used

HDLC Frame Structure Ø Synchronous transmission of frames Ø Single frame format used

Flag Fields and Bit Stuffing Delimit frame at both ends with 01111110 seq. Ø

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 Ø l l l 0 inserted after every sequence of five 1 s If receiver detects five 1 s it checks next 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 sixth and seventh bits 1, sender is indicating abort

Address Field Identifies secondary station that sent or will receive frame Ø Usually 8

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

Control Field Ø Different for different frame type l Information - data transmitted to

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

Control Field Use of Poll/Final bit depends on context Ø In command frame, is

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 Ø Seq. number usually 3 bits Ø l can extend to 8 bits as shown below

Information & FCS Fields Ø Information Field l l l In information and some

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

HDLC Operation Ø Consists of exchange of information, supervisory and unnumbered frames. Ø Have

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

HDLC Operation Example

HDLC Operation Example

HDLC Operation Example – Contd.

HDLC Operation Example – Contd.

Summary Ø Introduced need for data link protocols Ø Flow control Ø Error control

Summary Ø Introduced need for data link protocols Ø Flow control Ø Error control Ø HDLC