William Stallings Data and Computer Communications Chapter 7 Data Link Control
Flow Control zEnsuring the sending entity does not overwhelm the receiving entity yPreventing buffer overflow zTransmission time yTime taken to emit all bits into medium zPropagation time yTime for a bit to traverse the link
Model of Frame Transmission
Stop and Wait zSource transmits frame zDestination receives frame and replies with acknowledgement zSource waits for ACK before sending next frame zDestination can stop flow by not send ACK zWorks well for a few large frames
Fragmentation zLarge block of data may be split into small frames yLimited buffer size yErrors detected sooner (when whole frame received) yOn error, retransmission of smaller frames is needed yPrevents one station occupying medium for long periods zStop and wait becomes inadequate
Stop and Wait Link Utilization
Sliding Windows Flow Control zAllow multiple frames to be in transit zReceiver has buffer W long zTransmitter can send up to W frames without ACK zEach frame is numbered zACK includes number of next frame expected zSequence number bounded by size of field (k) yFrames are numbered modulo 2 k
Sliding Window Diagram
Example Sliding Window
Sliding Window Enhancements zReceiver can acknowledge frames without permitting further transmission (Receive Not Ready) zMust send a normal acknowledge to resume zIf duplex, use piggybacking yIf no data to send, use acknowledgement frame yIf data but no acknowledgement to send, send last acknowledgement number again, or have ACK valid flag (TCP)
Error Detection zAdditional bits added by transmitter for error detection code zParity yValue of parity bit is such that character has even (even parity) or odd (odd parity) number of ones yEven number of bit errors goes undetected
Cyclic Redundancy Check zFor a block of k bits transmitter generates n bit sequence zTransmit k+n bits which is exactly divisible by some number zReceive divides frame by that number yIf no remainder, assume no error yFor math, see Stallings chapter 7
Error Control zDetection and correction of errors zLost frames zDamaged frames zAutomatic repeat request yError detection yPositive acknowledgment yRetransmission after timeout yNegative acknowledgement and retransmission
Automatic Repeat Request (ARQ) zStop and wait zGo back N zSelective reject (selective retransmission)
Stop and Wait zSource transmits single frame zWait for ACK zIf received frame damaged, discard it yTransmitter has timeout yIf no ACK within timeout, retransmit zIf ACK damaged,transmitter will not recognize it yTransmitter will retransmit yReceive gets two copies of frame yUse ACK0 and ACK1
Stop and Wait - Diagram
Stop and Wait - Pros and Cons zSimple zInefficient
Go Back N (1) zBased on sliding window zIf no error, ACK as usual with next frame expected zUse window to control number of outstanding frames zIf error, reply with rejection yDiscard that frame and all future frames until error frame received correctly yTransmitter must go back and retransmit that frame and all subsequent frames
Go Back N - Damaged Frame zReceiver detects error in frame i zReceiver sends rejection-i zTransmitter gets rejection-i zTransmitter retransmits frame i and all subsequent
Go Back N - Lost Frame (1) zFrame i lost zTransmitter sends i+1 zReceiver gets frame i+1 out of sequence zReceiver send reject i zTransmitter goes back to frame i and retransmits
Go Back N - Lost Frame (2) zFrame i lost and no additional frame sent zReceiver gets nothing and returns neither acknowledgement nor rejection zTransmitter times out and sends acknowledgement frame with P bit set to 1 zReceiver interprets this as command which it acknowledges with the number of the next frame it expects (frame i ) zTransmitter then retransmits frame i
Go Back N - Damaged Acknowledgement zReceiver gets frame i and send acknowledgement (i+1) which is lost zAcknowledgements are cumulative, so next acknowledgement (i+n) may arrive before transmitter times out on frame i zIf transmitter times out, it sends acknowledgement with P bit set as before zThis can be repeated a number of times before a reset procedure is initiated
Go Back N - Damaged Rejection zAs for lost frame (2)
Go Back N - Diagram
Selective Reject zAlso called selective retransmission zOnly rejected frames are retransmitted zSubsequent frames are accepted by the receiver and buffered zMinimizes retransmission zReceiver must maintain large enough buffer zMore complex login in transmitter
Selective Reject - Diagram
High Level Data Link Control zHDLC zISO 33009, ISO 4335
Frame Structure zSynchronous transmission zAll transmissions in frames zSingle frame format for all data and control exchanges
Frame Structure Diagram
Flag Fields zDelimit frame at both ends z zMay close one frame and open another zReceiver hunts for flag sequence to synchronize zBit stuffing used to avoid confusion with data containing y0 inserted after every sequence of five 1s yIf receiver detects five 1s it checks next bit yIf 0, it is deleted yIf 1 and seventh bit is 0, accept as flag yIf sixth and seventh bits 1, sender is indicating abort
Bit Stuffing zExample with possible errors
Required Reading zStallings chapter 7 zWeb sites on HDLC, frame relay, Ethernet and ATM