350 likes | 589 Views
Data and Computer Communications. Updated: 2/9/2009. Data Link Control Protocols. They are required to provide a layer of logic to manage exchange of data over a link frame synchronization flow control error control addressing control and data link management. Flow Control. Objectives
E N D
Data and Computer Communications Updated: 2/9/2009
Data Link Control Protocols • They are required to provide a layer of logic to manage exchange of data over a link • frame synchronization • flow control • error control • addressing • control and data • link management
Flow Control • Objectives • Sender does not flood the receiver - prevents buffer overflow • Maximize throughput • Basic Idea • Sender throttled until receiver grants permission • Impacted by • Transmission time • time taken to emit all bits into medium • Propagation time • time for a bit to traverse the link • Two basic types are discussed • Stop-and-Wait FC • Sliding Window FC
A virtual time sequence diagram Illustrating the sender-receiver relationship Space Time Diagrams
Stop and Wait Flow Control • Basic Idea • Source transmits frame • Destination receives frame and replies with acknowledgement (ACK) • Source waits for ACK before sending next • Destination can stop flow by not send ACK
Performance • Works well for a few large frames • Stop and wait becomes inadequate if large block of data is split into small frames
Efficiency of Stop&Wait We define parameter a: Utilization (or efficiency) can be calculated as: What happens if a changes? Examples of signal speed: Light in vacuum: 300 m/ms Light in fiber: 200 m/ms Electricity: 250 m/ms The textbook uses B for tprop and L for tframe
Performance Examples How high is the satellite? Assume data rate = 56 Kbps: Find tfrme, a, and Utilization Assume frame size is 500 bytesFind tfrme, a, and Utilization
Maximum Utilization Utilization Ideal Plot the efficiency plot For the problems using Matlab Actual a
Sliding Windows Flow Control • Allows multiple numbered frames to be transmitted • Receiver has buffer W long • Transmitter sends up to W frames without ACK • Receiver sends an ACK • ACK includes number 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 (Receive Not Ready) • Must send a normal acknowledge to resume • if have full-duplex link, can piggyback ACks
Sliding Window Diagram W=5, 3 bits are required, ACK: 0,1,2,3,4,0,1,
Sliding Window Example Why W is not 8? Window shrinking until ACK is received Window expands as soon as ACK is sent Window expands as soon as ACK is received W=7, 3 bits are required, ACK: 0,1,2,3,4,6,7,0,1,
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) • Error control mechanisms used in • stop and wait • go back N • selective reject (selective retransmission)
ARQ in Stop and Wait ACK0 / ACK1 • Source transmits single frame • Wait for ACK • If received frame damaged, discard it • transmitter has timeout • if no ACK within timeout, retransmit • if ACK damaged,transmitter will not recognize it • transmitter will retransmit • receive gets two copies of frame • use alternate numbering and ACK0 / ACK1 • pros and cons • simple • inefficient Remember: Special case where W=1
ARQ in Go Back N • Based on sliding window • If no error, ACK (RR) as usual • Use window to control number of outstanding frames • If error, reply with rejection (REJ) • Discard that frame and all future frames until error frame received correctly • Transmitter must go back and retransmit that frame and all subsequent frames Frames 5 & 6 are resent Lost ACK, P=1 Nothing sent until ACK is received Lost ACK, P=1
Go Back N Scenarios which are handled • Damaged Frame • Frame received with error • Frame lost • Last frame lost • Damaged Ack • One ack lost, next one makes it • All acks lost • Damaged Nack • Maximum Window = 2n -1 with n-bit sequence numbers
Selective Reject • Also called selective retransmission • Only rejected frames are retransmitted • Subsequent frames are accepted by the receiver and buffered • Cons and pros • Minimizes retransmission • Receiver must maintain large enough buffer • More complex logic in transmitter • Applications • Less widely used • Useful for satellite links with long propagation delays Resend Only Corrupted one Only frame 4 is resent P=1; Resent ACK Nothing sent until ACK is received Applet: http://media.pearsoncmg.com/aw/aw_kurose_network_3/applets/SelectRepeat/SR.html
Performance Comparison P is the probability that a single frame is in error; Assume that ACK and NAK are never in error.
High Level Data Link Control (HDLC) • An important data link control protocol • station types: • Primary – issue commands • Secondary - issue Responses • Combined - issues commands and responses • link configurations • Unbalanced - 1 primary, multiple secondary • Balanced - 2 combined stations
HDLC Transfer Modes • Normal Response Mode (NRM) • Response from secondary • Asynchronous Balanced Mode (ABM) • Combined Station, 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
HDLC Frame Structure • synchronous transmission of frames • single frame format used for all data types Data Header Trailer Frame Check Sequence = FCS
Flag Fields and Bit Stuffing From Jain
Address Field • Identifies secondary station that sends or receives frame • Usually 8 bits long • May be extended to multiples of 7 bits • LSB indicates if is the last octet (1) or not (0) • all ones address 11111111 is broadcast Frames arte multiples of 8-bit (octets) Last octet
Control Field • Different for different frame type (I, S, U) • Information - data transmitted to user (next layer up) • Flow and error control piggybacked on information frames (includes N(s) and N(R)) • Supervisory - ARQ when piggyback not used • Unnumbered - supplementary link control • First 1-2 bits of control field identify frame type • I=0, S=10, U=11
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 • Sequence number usually 3 bits • can extend to 7 bits as shown below S=Supervisory function bit http://www.erg.abdn.ac.uk/users/gorry/course/dl-pages/hdlc-control.html
Information & FCS Fields • Information Field • Exists in information and some unnumbered frames • It must contain integral number of octets • Variable length • Frame Check Sequence Field (FCS) • Used for error detection • Either 16 bit CRC or 32 bit CRC
HDLC Operation • consists of exchange of information, supervisory and unnumbered frames • Consists of three phases • Initialization • by either side, set mode & sequence • data transfer • with flow and error control • using both I & S-frames (RR, RNR, REJ, SREJ) • disconnect • when ready or fault noted
HDLC Operation Example Set normal response/responses Set mode accepted Full Duplex Refer to HDLC Commands HDLC Commands