370 likes | 381 Views
Data and Computer Communications. Data Link Control Protocols. Data Link Control Protocols. Need a logical layer above physical layer To manage exchange of data over a link Frame synchronization Flow control Error control Addressing Control and data on same link Link management.
E N D
Data and Computer Communications Data Link Control Protocols
Data Link Control Protocols • Need a logical layer above physical layer • To manage exchange of data over a link • 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 • By preventing buffer overflow • Influenced by: • Transmission time • Time taken to emit all bits into medium • Propagation time • Time for a bit to traverse the link • Assume here no errors but varying delays
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 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 line using the stop-and-wait scheme • Example: Long message sent as a sequence of frames F1, F2, …., Fn • Station S1 sends F1. • Station S2 sends an acknowledgment. • Station S1 sends F2. • Station S2 sends an acknowledgment. • Station S1 sends Fn. • Station S2 sends an acknowledgment.
Stop and Wait: Performance • Total time to send the data, T, can be expressed as T = nTF, where TF is the time to send one frame and receive an acknowledgment. TF = tprop + tframe + tproc + tprop + tack + tproc Where: • tprop = propagation time from S1 to S2 • 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: • Processing time is relatively negligible • Acknowledgment frame is very small compared to a data frame • We obtain: T = n (2tprop + 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: • 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,
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 2k • giving max window size of up to 2k - 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
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
Error Free Sliding Window: Performance • Case 1: W ≥ 2a + 1 • 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 < 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
Error Free Sliding Window:Link Utilization • Utilization is expressed as:
Error Control • Detection and correction of errors such as: • Lost frames • Damaged frames • Common techniques use: • Error detection • Positive acknowledgment • Retransmission after timeout • Negative acknowledgement & retransmission
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 • Receiver rejects frame • Transmitter has timeout • If no ACK within timeout, retransmit • Damaged ACK • Transmitter does not recognize, retransmits • Receiver gets two copies of frame • Uses alternate numbering for ACKs to distinguish: ACK0 and ACK1
Stop and Wait • Example: Both types of errors • Pros and cons • Simple • Inefficient
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, Tp is the propagation time
Stop and Wait: Performance • If error occurs, where Nr is the expected no. of transmissions of a frame. • Since Tt / Tf = (1+2a), we obtain: • Probability that it will take exactly k attempts to transmit a frame successfully: Pk-1(1-P) • P is the probability that a single frame is in error
Stop and Wait: Performance • Therefore, for Stop-and-Wait,
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 • Transmitter must go back and retransmit that frame and all subsequent frames
Go-Back-N ARQ – Details • Damaged Frame • Error in frame i so receiver rejects frame i • Transmitter retransmits frames from i • Lost Frame • Frame i lost and either • Transmitter sends i+1 andreceiver 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 • Transmitter then retransmits frames from i
Go-Back-N ARQ – Details • Damaged Acknowledgement • 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 • 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 than 1 frame. where f(i) is the total no. of frames transmitted if the original frame must be transmitted itimes
Go-Back-N ARQ: Performance • K = (2a + 1) for W ≥ (2a + 1) • K = W for W < (2a + 1)
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
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-3)