Ch4: Protocol Basics Key Learning Points ARQ’s and Error Control (idle RQ, selective repeat, Go-back-N) Protocol Spec - PowerPoint PPT Presentation

slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Ch4: Protocol Basics Key Learning Points ARQ’s and Error Control (idle RQ, selective repeat, Go-back-N) Protocol Spec PowerPoint Presentation
Download Presentation
Ch4: Protocol Basics Key Learning Points ARQ’s and Error Control (idle RQ, selective repeat, Go-back-N) Protocol Spec

play fullscreen
1 / 87
Ch4: Protocol Basics Key Learning Points ARQ’s and Error Control (idle RQ, selective repeat, Go-back-N) Protocol Spec
270 Views
Download Presentation
lilike
Download Presentation

Ch4: Protocol Basics Key Learning Points ARQ’s and Error Control (idle RQ, selective repeat, Go-back-N) Protocol Spec

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Ch4: Protocol Basics • Key Learning Points • ARQ’s and Error Control (idle RQ, selective repeat, Go-back-N) • Protocol Specification • State Diagrams, Extended Event Tables • Flow Control: Sliding Windows • Sequence Numbers • Link Management – Service Primitives

  2. CH 4: Protocol Basics • Transmission Services: • Best Effort (connectionless)  detect errors and discard data • Reliable (connection oriented): high probability that • - data is free of errors • - no duplicates • - in correct sequence • Data Link Protocols: provide a reliable transmission channel • on an isolated network or point-point connection • error control • flow control • addressing

  3. 4.1 Error Control • manual error control: if character is undesired  delete and retype • - kbd inputs character • - CPU: reads/stores character • - CRT displays character • Automatic Repeat Request: (ARQ): non-intrusive to layer 3 • - sender transmits frame over serial data link • - receiver checks incoming frame for error • if error detected NAK (request another copy) • if no error detected ACK (acknowledge receipt)

  4. 4.2: Idle RQ: (aka send & wait or stop & wait) • reliable transferof frames between 2 DTE’s on a serial data link • without errors • in order • without duplicates • Idle RQ Operations: • Idle RQ operates in ½ duplex mode • P can have only 1 unACKed I-frame at any time • 2 types of ARQ • (1) idle RQ: 1 frame transmitted & unacked at any time • (2) continuous RQ:m frames transmitted & unacked at any time • selective repeat • go back N

  5. 2 basic implementations of Idle-RQ: Implicit and Explicit • (1) Implicit Retransmissions: time-out implies NAK • - P transmits I-frame and starts timer • - S ACKs on receipt of error free I-frame • - P can transmit another I-frame on receipt of error free ACK • - P retransmits I-frame on timeout (implied NAK) • - S discards duplicate I-frames & ACKs duplicate (ACK corrupted) • Elements of Idle RQ • P (primary): source DTE • S (secondary): destination DTE • I-frame: data or information frame • ACK frame: indicates I-frame correctly received • NAK frame: indicates I-frame not received (corruption detected)

  6. (2) Explicit Retransmission • - P transmits I-frame and starts timer • - S ACKs on receipt of error free I-frame • - S NAKs on receipt of corrupt I-frame • - P can transmit another I-frame on receipt of error free ACK • - P retransmits I-frame on timeout or NAK • Pmusthave a timer for each I-frame for both methods • all corrupt frames are discarded (I-Frames & ACK frames)

  7. duplicate frame:lost or corrupt ACK  results in duplicate I-frame • Sequence numbersused to detect duplicates • N(S) = I-frame’s sequence number • - set by P before I-frame is transmitted • N(R) = sequence number in ACK or NAK indicates which I- • frame was received • - set by S before ACK/NAK is transmitted • V(R) maintained by S, tracks next expected I-frame • V(S) maintained by P, tracks next I-Frame to send • Duplicates are detected when N(s) V(R) • S discards all duplicate I-frames • S ACKs all correctly received I-frames (duplicates too)

  8. start timer start timer start timer 0 I(0) I(1) I(2) I(0) I(1) I(2) A(0) A(1) I(0) I(1) I(2) 0 2 1 1 2 Idle RQ without any corrupt frames – same for explicit & implicit Primary V(s) Tx Buffer Rx Buffer V(R) Secondary

  9. start timer start timer time-out - retx 0 I(1) I(0) I(0) I(1) I(0) I(1) 1 I(1) I(1) 1 0 1 1 A(0) A(1) Implicit Idle RQ with corrupt I-frame Primary V(s) ReTx Buffer Rx Buffer V(R) Secondary

  10. start timer start timer start timer I(0) I(1) I(1) I(0) I(1) I(1) A(0) N(1) A(1) I(0) I(1) 1 0 1 1 1 0 Explicit Idle RQ with corrupt I frame Primary V(s) ReTx Buffer Rx Buffer V(R) Secondary

  11. start timer time-out - retx 0 I(0) I(1) I(0) I(1) A(1) I(0) I(1) 1 duplicate discarded I(1) I(1) 2 0 start timer 1 1 A(0) A(1) • Corrupt ACK or NAK results in duplicate I-frame • same for implicit or explicit Primary V(s) ReTx Buffer Rx Buffer V(R) Secondary

  12. ACK ACK N(R) BCC . NAK NAK N(R) BCC . I - f rame SOH N(S) STX payload ETX BCC Protocol Data Units (PDU):Specifies Frame Format • SOH: place at frame head  signal the start of new frame • N(S), N(R): Sequence Numbers • STX, ETX: delimits payload • BCC: error detection field

  13. Primary I(N) Secondary A(N) • time-out interval for I-frame retransmissions • Minimum duration: • time for I-frame transmission and processing • time for ACK frame transmission and processing • avoid ACK being received after I-frame re-sent • time-out interval varies for different data links • - geographic span • - data rate • - immediate NAK can significantly improve link utilization

  14. Link utilization: affected by retx delay resulting from corrupt frames • implicit ReTx  time out interval • explicit ReTx NAK transmission • NAK transmission time, processing time << time out interval • * most applications use explicit ReTx • how to improve link utilization reduce number of corrupt frames • reduce BER • reduce the length of frames • trade-offs: cost, complexity, overhead, bandwidth efficiency…

  15. send & receive files e.g. file transfer application running on 2 CPU’s Application Application send & receive frames bit pipe FTP FTP signals Data Link Data Link Physical Layer Physical Layer • 4.2.1 Layered Architectures • decouple application & communications tasks • layer = set of well-defined sub-tasks • each layer performs well-defined functions in context of application • data link layer offers defined services to layer above it • protocol defines operations • increase sophistication (services) by adding layers

  16. application layer • concerned with file transfers • uses services provided by communications protocol file server Idle RQ client application interface(API) ~ function calls used by application • application - application protocol specifies: • file name, file length • segment & reassemble of data into blocks • sequence of msg blocks • encapsulate blocks into application PDUs (AP PDU’s) • service primitives used to transfer AP PDU’s • transparent to communication layer, just data blocks (frames)

  17. L_DATA.indication L_DATA.request • Service primitives: provides services between layers • used by both P and S • user data: transmitted data • L_DATA.request: User Service Primitive at Send Interface • L_DATA.indication: User Service Primitive at Destination • Interface • LS: indicates Link Service, L = indicates link layer file server client idle RQ S idle RQ P

  18. Service Users • concerned withfunctional aspectsof service • don’t care about implementation • services can be represented with time sequence diagram • idle RQ protocol • attempts to reliably deliver series of frames • specify frame size  depends on BER and other issues • - smaller frames  with errors, retransmit fewer, smaller frames • idle RQ protocol layer:provide well-defined services at P & S • reliably transmit I-frames without duplicates, in order • define max_frame_size for I-frames • transmit I-frames • generate & transmit ACK, NAK frames • monitor timeouts

  19. L_Data.request User Data [n] L_Data.indicate User Data [n] Destination AP Source AP AP-AP PDU’s ECB ECB S P LS Prov. Q LS User Q I-frame ACK • FIFO:queue used to decouple layers • ECB (event control block): record or structure for passing service • primitive between layers • - 1st field indicates service primitive type • - 2nd field holds user data (array of bytes, etc)

  20. (1) Source AP sends msg to Destination AP: • obtain free ECB  copy data to user data field • set primitive field to L_Data.request • enqueue ECB into LS_user input queue • (2)Processing by Idle RQ Primary • detect ECB entry in LS_user input queue  processes 1st entry • create I-frame with contents = user data, append header/trailer • initiates transmission to Idle RQ Secondary • (3)Secondary scheduled at receiver • if no error  strip off I-frame header & trailers • passes frame contents to destination AP in an ECB • uses LS_provider output queue w/ primitive = L_DATA.indicate • creates & transmits ACK frame

  21. (4)Destination AP • detects & reads ECB f/ LS_Provider queue • processes contents of msg block according to AP-AP protocol • ie: 1st block with filename and operation (create file, open file…) • (5)Idle RQ Primary • if no error in ACK free buffer holding previously sent I-frame • check LS_user input queue for pending ECB • repeat until all file segments transmitted (6)Sending AP: usually sends ‘End of Transfer’ block to Destination AP

  22. 4.2.2 Protocol Specification • define protocol operation: all possible events, error conditions… • - required to design and test protocol • - complex process that requires precise methods & formalisms • frame sequence diagrams useful for illustrating aspects of protocol • - are not a protocol specification • - often combined and use with protocol specification • protocol specification: • - state transition diagrams • - extended event-state tables • - structured programs (Program Design Language)

  23. protocol modeling:finite state machine • protocol entity can be in 1 of several well-defined states at any time • incoming events trigger state transitions and/or outgoing event • - NAK received • outgoing events generated by incoming event • - retransmit I-frame on NAK arrival • predicates (Pi) boolean condition used to specify • - local or specific actions: start timer, increment variable • - outgoing event: if P1 == TRUE  retransmit I-frame

  24. 4.2.3 Idle RQ specification: • All finite state machines operate atomically • if incoming event starts processing  processing completed • indivisibly • generation of outgoing events • local (specific) actions • changes in state

  25. Interface Buffers (queues) • decouple incoming/outgoing event interfacesfrom protocol entities • - ideally 1 queue interfaces P & S to respective AP’s • - practically 2 queues used to enable duplex flow of primitives • additional queues between • - Idle RQ protocol entity  Tx-Rx Procedure • - Idle RQ protocol entity  Timer • Protocol Entity - Idle RQ • Tx-Rx Procedure: manages transmission control circuit • - transmit pre-formatted frame passed to it • - receive a frame from link enqueues frame for protocol entity • - can be interrupt driven from transmission control ckt

  26. Source AP Destination AP LS_user LS_provider TIM_provider Idle RQ protocol entity S Idle RQ protocol entity P timer TIM_user PHY_provider PHY_user Tx-Rx Interface Tx-Rx Interface Transmission Control Circuit Transmission Control Circuit

  27. (1) State Diagrams: • state variables: retain state information as incoming events arrive • useful for showing correct protocol operations • space limitations  impractical to show all possible events & • conditions • most state transition diagrams are incomplete specifications • complete protocol requires many such diagrams • states are ovals: stable points which can be altered by events • arcs indicate possible transition between states • events are occurrences that can cause change in state • - incomingevent that cause transitions, sources are queues: LS • user, PHYprovider, TIMprovider • - outgoing events that result from transition, source are queues: • LSprovider, PHYuser • specific actions: actions internal to state

  28. IRCVD +,LDATAind, TxACK, [1][2] WTIFM IRCVD-,TxNAK

  29. (2) Extended event-state table: • more rigorous method to specify protocol • basic event-state table: for any incoming event - only 1 action • and 1 next state • extended event-state table: predicates allow alternate actions • and next states - readily implementedin SW - widely used • for each protocol state (present) & for all possible incoming events • define outgoing events • define specific actions • define alternative actions using predicates • define new state • interpret actions for predicates in order

  30. Extended event-state table Primary

  31. Extended event-state table Secondary

  32. (3) PDL Protocol Specification: (pseudocode) • detailed description of : events, states, actions, predicates • simplifies implementation  less prone to errors • Extended State Transition Model (Estelle) - not widely used • similar to pseudocode specification, protocol entity defined • as module • transition defined more formally

  33. Primary I(N) AN I(N+1) Secondary I(N) AN I(N+1) Tp Tix Tip Tp Tax Tap 4.2.4 Link Utilization Tp = propagation delay ( geographic span) Tix= frame transmit time ( bit rate & frame size) Tip= frame processing time Tax = ack transmit time Tap= ack processing time

  34. Link UtilizationEfficiency (1) Ideal Link (no corruption): U = assume Tip << Tix and that Tax, Tap are negligible U = Leta = U

  35. a T vs T U p ix very small T << T high p ix » » » 1 T T 1 p ix very large T >> T low p ix low bit rates, small geographic spans  small a (Tp < Tix) high bit rates, large geographic span  large a(Tp > Tix)

  36. (2) if BER > 0 • Nr= avg transmission attempts for successful transmission • derived from knowledge of BER (assume random errors) • P = probability bit will be corrupt • 1-P= probability bit will not be corrupt • (1-P)n = probability frame with n bits will not be corrupt • Pf = 1 - (1-P)n = probability frame withnbits will be corrupt • if n P << 1 Pf  n P

  37. probability frame is received correctly  1- Pf • average number of transmissions attempts  Nr= (1- Pf )-1 • assume ack frames not corrupt  ack lengths << I-frame length • Link Utilization Efficiency: Divide By NrU  • Performance Trade-Offs for idle RQ • Buffer Storage vs Link Utilization Efficiency • Buffer Storage - idle RQ requires minimum buffer storage • Link Utilization - P waits on ACK before next frame transmitted • P & S need only store 1 I-frame • S must maintain record of Last Correct Frame to detect duplicates • - Used in simple devices (terminal, PC) • - Link Utilization = 100% if Tp < Tix (Small a)

  38. 4.3 Continuous RQ • Improved Link Utilization: without bit errors  ~100% • P usually has limit on number of unACKed I-frames • Requires Buffer Storage & Mgt • Requires Duplex Links • Each I-frame & ACK has a corresponding identifier • Retransmission Strategies • corrupt frames are discarded • ReTx triggered by next correct frame received or timers Two General Variants (1) Selective Repeat: S detects & requests ReTx of just frames it needs (2) Go-Back-N: S detects out-of-order I-frame, requests ReTx of all unACKed frames

  39. Primary sends I-frame continuously doesn’t wait for ACKs • maintains retransmission list:copies of sent unACKed I-frames • ACK received  remove I-Frame from retransmission • maintains sequence variable V(S) - indicates N(S) for next I- • frame to be sent • Secondary returns ACK for each correct I-frame • enqueues correct frames in Link Receive List for AP processing • immediately deliver payload of in-sequence frame to AP(LS_user) • out-of-order frames kept in Link Receive List until in-order frame • received • maintain receive sequence variable V(R) next expected I-frame

  40. AP-Link Layer FIFO Queue interfaces • no relationship to Link Receive List, Retransmission List • lists are internal use only, ensure reliable delivery • practical issue: transmission control circuit detects & discards corrupt frames • notifies Link Layer with Status register, interrupt • practically, S isn’t involved in detection and discard of corrupt • I-frames

  41. 4.3.1 Selective Repeat • Initiating Retransmission of corrupt frames  idle RQ • 1.Implicit ReTx: • S ACKs correctly received frames • P determines if frame is lost from ACK sequence or time out • 2.Explicit ReTx: • S ACKs correctly received frames • S NAKs frames lost or discarded from sequence • both hold out-of-order frames in Link Receive List until in-order • frame received • in-order frame(s) are passed to next layer (ordered delivery)

  42. Primary V(s) ReTx List (unACKed) Tx Buffer Rx Buffer Link Rx List (out of order) V(R) Secondary 0 4 3 2 0 1 1 0 0 4 3 2 3 2 1 2 1 0 I(4) I(0) I(2) I(3) I(1) 3 1 2 4 I(0) I(1) I(2) I(3) I(4) A(3) A(0) A(2) A(1) I(2) I(1) I(3) I(0) 1 3 2 0 Assume No Corruption, Implicit ReTx

  43. (1) Assume all ACKs received correctly and I-frame(1) is corrupt • S ACKs each correctly received I-frame (0,2,3 …) • P receives ACK(2)  detects I-frame(1) is unACKed (or times • out) • Enters ReTx State (allows for more than 1 corrupt frame) • transmission of new frames suspended until all unACKed • frames ReTx • removes I frame(2) f/ ReTx List • ReTx I-frame(1) before transmitting N+5 • S On receipt of I-frame(1) forwards frames in link receive list to • LS_user in correct sequence

  44. Primary V(s) ReTx List (unACKed) Tx Buffer time out, missing ACK Secondary Rx Buffer Link Rx List (out of order) V(R) I(0) I(1) I(2) I(3) I(1) I(4) I(5) I(0) I(2) I(3) I(1) I(4) 2 3 2 4 3 2 4 1 3 0 2 5 4 3 2 1 4 3 1 5 4 1 1 0 3,4 2 1 0 2 1 0 I(5) I(2) I(1) I(3) I(4) I(0) I(1) 1 1 1 1 5 1 A(2) A(1) A(0) A(4) A(3) 0

  45. 2. Assume all I-frames received correctly and ACK(1) frame • is corrupt • P On receipt of ACK(2)  detects I-frame(1) is unACKed & • ReTx I-frame(1) • S On receipt of ReTx of I-frame(1), detects duplicate using V(R) • Discards duplicate I-frame(1) • ReTx ACK(1) • P On receipt of ACK(1), removes I-frame(1) from ReTx List • relies on receipt of ACKs to initiate ReTx of corrupt frames • sequence variable V(S), V(R), or timers used to detect missing or • discarded frames

  46. time out or notice missing ACK I(0) I(1) duplicate detected & discard – frame, ack I(0) I(1) I(2) I(3) I(4) I(1) I(5) I(2) I(1) I(4) I(3) 5 4 3 2 0 4 1 5 4 1 0 3,4 2 1 3 2 1 4 3 1 2 1 0 1 0 I(3) I(1) I(4) I(5) I(2) I(0) I(1) 4 1 5 3 6 2 A(2) A(1) A(0) A(4) A(1) A(3) Primary V(s) ReTx List (unACKed) Tx Buffer Secondary Rx Buffer Link Rx List (out of order) V(R) 0

  47. (3) selective reject:alternative that uses explicit NAKs • ACK(N) acknowledges all frames in ReTX list up to/including • I-frame(N) • Timer used with each NAK to ensure ReTx if NAK is corrupted • only 1 NAK outstanding at any time, • - if NAK(N) corrupted ACK(N+1) erroneously acks I-frame(N) • - I-frame(N) frame is lost

  48. Assume I-frame(N+1) corrupt, all ACKs received correctly • S receives I-frame(0)  transmits ACK(0) • S receives I-frame(2)  detects that I-frame(1) missing and enters • ReTx state: • transmits NAK(1) • suspends transmission of ACKs • P receives NAK(1)  ReTx I-frame(1) • Sreceives I-frame(1), leaves ReTx state, resumes ACKs • ACK(3) acknowledges all frames up to and including I-frame(3) • ACK(2) is unnecessary

  49. 3,4,5 2 1 1 0 I(1) I(4) I(6) I(3) I(5) I(1) I(1) I(4) I(5) I(0) I(1) I(2) I(3) A(0) N(1) A(3) A(4) I(5) I(1) I(0) I(2) I(3) I(4) 2 3 2 0 1 1 1 1 5 6 4 2 3 0 5 1 3 6 6 5 4 3 2 1 2 1 0 3 2 1 3,4 2 1 0 I(2) I(0) 4 Assume I-frame(N+1) corrupt, all ACKs received correctly Primary V(s) ReTx List (unACKed) Tx Buffer Secondary Rx Buffer Link Rx List (out of order) V(R)