550 likes | 659 Views
No Class Thursday 10/3 Office hours: Tue 3:15-4 W 12-1 Evans 315. Data Link Layer. Physical layer: sending signals over transmission medium. Data link layer: responsible for error-free (reliable) communication between adjacent nodes.
E N D
No Class Thursday 10/3 • Office hours: Tue 3:15-4 • W 12-1 • Evans 315 University of Delaware CPEG 419
Data Link Layer • Physical layer: sending signals over transmission medium. • Data link layer: responsible for error-free (reliable) communication between adjacent nodes. • Functions: flow control, error control, framing, fragmentation, and addressing (in multipoint medium). University of Delaware CPEG 419
Flow Control • What is it? • Ensures that transmitter does not overrun receiver: limited receiver buffer space. • Receiver buffers data to process before passing it up. • If no flow control, receiver buffers may fill up and data may get dropped. University of Delaware CPEG 419
Stop-and-Wait • Simplest form of flow control. • Transmitter sends frame and waits. • Receiver receives frame and sends ACK. • Transmitter gets ACK, sends other frame, and waits. • This continues until there are no more frames to send. • This is a good method if the propagation delay and data rate is small. Otherwise, it leads to low link utilization. University of Delaware CPEG 419
Bandwidth Delay Product • Suppose that the baud rate is 10Mbaud/s. • Suppose that there are 10bits per symbol. • Suppose that the propagation delay is 25ms. • How many bits can fill the wire? • Baud rate * bits/symbol * delay = bits • 10M*10*0.06 = 2500000 bits (2.5Mb)! • This is bandwidth * delay = bandwidth delay product. • Suppose that we send a frame of 1500*8 bits over this link and use stop and wait. What is the link utilization? For a satellite, stop and wait is not a good approach. For a wireless link like 802.11, its ok (and is used) University of Delaware CPEG 419
Transmission Delay • Suppose the data rate is 100Mbps. • Suppose the frame is 1500bytes. • How long does it take to put the frame on the wire? (This is transmission delay.) How long to send a frame over this link if the propagation delay is 25ms? University of Delaware CPEG 419
Sliding Window 1 • Allows multiple frames to be in transit at the same time. • Receiver allocates buffer space for n frames. • Transmitter is allowed to send n (window size) frames without receiving ACK. • Frame sequence number: labels frames. University of Delaware CPEG 419
Sliding Window 2 • Receiver ack’s frame by including sequence number of next expected frame. • Cumulative ACK: ack’s multiple frames. • Example: if receiver receives frames 2,3, and 4, it sends an ACK with sequence number 5, which ack’s receipt of 2, 3, and 4. University of Delaware CPEG 419
Sliding Window 3 • Sender maintains sequence numbers it’s allowed to send; receiver maintains sequence number it can receive. These lists are sender and receiver windows. • Sequence numbers are bounded; if frame reserves k-bit field for sequence numbers, then they can range from 0 … 2k -1 and are modulo 2k. University of Delaware CPEG 419
Sliding Window 4 • Transmission window shrinks each time frame is sent, and grows each time an ACK is received. University of Delaware CPEG 419
Example University of Delaware CPEG 419
Sliding Window (cont’d) • RR (ready to receive) n acknowledges up to frame n-1. • There is also RNR n, which ack’s up to frame n-1 but no longer accepts more frames. • RNR shuts down the receive window and consequently the transmission window. • Need subsequent RR to re-open window. University of Delaware CPEG 419
Piggybacking • When both endpoints transmit, each keeps 2 windows, transmitter and receiver windows. • Each send data and need to send ACKs. • When sending data, transmitter can “piggyback” the acknowledgment information. • When no data, send just the ACK. University of Delaware CPEG 419
Duplicate ACKs • When no data, must re-send last ACK. • Duplicate ACKs: report potential errors. University of Delaware CPEG 419
Error Detection • Transmission impairments lead to transmission errors: change of 1 or more bits in transmitted frame. • Transmission errors defined using probabilities: transmission medium modeled as a statistical system. University of Delaware CPEG 419
Error Probabilities 1 • Definitions: • Pb probability of single bit error (bit error rate); constant and independent for each bit. • P1 probability frame received with no errors. • P2 probability frame received with 1 or more undetected errors. • P3 probability frame received with 1 or more detected bit errors, but no undetected ones. University of Delaware CPEG 419
Error Probabilities 2 • If no error detection mechanism, P3 = 0. • P1 = (1 - Pb)F and P2 = (1- P1), where F is size of frame in bits. • P1 decreases as Pb increases. • P1 decreases as F increases. University of Delaware CPEG 419
Example • 64-kbps ISDN channel’s bit error rate is less than 10-6. User requirement of on average 1 frame with undetected bit error per day. Frame is 1000 bits. • In a day, 5.529 x 106 frames transmitted. • Required frame error rate of 1/ 5.529 x 106, or P2 = 0.18 x 10-6. • But Pb = 10-6, so P1 = (1-Pb)F = 0.999 and P2 = 1 - P1 = 10-3, which is >>> required P2 University of Delaware CPEG 419
Error Detection Schemes • Transmitter adds additional bits for error detection. • Transmitter computes error detection bits as function of original data. • Receiver performs same calculation and compares results. If mismatch, then error. • P3 probability error detection scheme detects error; P2 residual error rate or probability error goes undetected. University of Delaware CPEG 419
Parity • Simplest error detection scheme. • Append parity bit to data block. • Example: ASCII transmission • 1 parity bit appended to each 7-bit ASCII character. • Even parity: 8-bit code has even number of 1’s. • Odd parity: 8-bit code has odd number of 1’s. University of Delaware CPEG 419
Parity Check • Example: transmitting ASCII “G” (1110001) using odd parity. • Code transmitted is 11100011. • Receiver checks received code and if odd number of 1’s, assumes no error. • Suppose it receives 11000011, then detects error. • NOTE: If more than 2 bits in error, may not be detected. University of Delaware CPEG 419
ISDN Example - Continued • BER = 10-6. • Frame errors might occur when two or more bit errors occur. Or, no frame error if no bit errors or one bit error. • 1 – ((1-Pb)1000 + 1000*(1-Pb)999*Pb)= 5e-7 • With no parity, the frame error prob. = 10-3 University of Delaware CPEG 419
Cyclic Redundancy Check • CRC is one of the most effective and common error detecting schemes. • Represent frames as polynomials • M= 1010001101 -> x9+x7+x3+x2+x0 • Both source and destination use a generator polynomial G – r bits/r-1 degree polynomial • Idea: Transmit extended frame [M|V], such that the polynomial representation is exactly divisible by G. Thus, if G does not exactly divide the received frame, there is an error. University of Delaware CPEG 419
CRC • How to find V such that G exactly divides [M|V]? • Divide xrM by G. Set V = the remainder. • [M|V] = xrM + V • [M|V]/G = (xrM + V)/G = xrM/G + V/G = S + V/G + V/G = S + 2V/G. But in binary 2 is the same as zero. So [M|V] / G = S. University of Delaware CPEG 419
CRC Example • Frame M 1010001101 = x9+x7+x3+x2+x0. • Pattern G 110101. • Dividing (frame*25) by pattern results in 01110. • Thus T 101000110101110. • Receiver can detect errors unless received message Tr is divisible by G. University of Delaware CPEG 419
CRC Performance and Generators • Instead of [M|V] we receiver [M|V] + E (E is the error). • Burst errors – CRC detects bursts of length r or less. • a string of errors, with E = 0 …0 1 X X X X 1 0 … • E(x) = xi(xk-1 + … + 1) where the burst length is k. • If G is degree k or greater and G has a 0th degree term, then G will not divide E. e.g. Will CRC detect single bit errors? Suppose that you use 4 bits (as in Ethernet), and BER is 106 what is the frame error probability? University of Delaware CPEG 419
CRC Performance and Generators • Burst Errors Continued • If the burst has length r+1, then the errors will not be detected if the burst is the same as G. If an error of length r+1 occurs and all combinations of errors are equally likely, then the burst will match G with prob. ½r-1. (So prob is BERr+1 x½r-1) • In general, for longer bursts, the prob. is ½r University of Delaware CPEG 419
CRC • Lastly, if G contains x+1 as a factor, and E has an odd number of bit, then G will not divide E. • In IEEE 802 x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 • CRC can be implemented in hardware with registers. • Problem: errors can occur in some pattern, so the probabilities are not quite right. University of Delaware CPEG 419
Error Correcting Codes • Hamming distance between bit strings: • The number of bits where the string differ • XOR them and count the 1’s • 1 0 1 0 0 1 0 0 1 0 0 0 1 1 0 = 2 – the distance is two. University of Delaware CPEG 419
Error Correcting codes • Take an n bit string and encode it as n+k bits in such a way that each encoded n bit string is at least d distance from any other encoded n bit string. Then you can detect errors of length d. • Do the same thing, but make it so the distance between any encoded n bit string is 2d+1 bits. Then the an error of d bits or less can be corrected by assigning the string to its closest legal value. University of Delaware CPEG 419
Error Correcting Code Legal strings – these are the encoded versions of n bit strings. Illegal strings – no n bit string is encode to these University of Delaware CPEG 419
Error Correcting Code But this code 0 1 1 0 1 0 is received Suppose that this code is 0 1 0 1 0 Then you know an error occurred, and you figure that what was meant to be sent is the code 0 1 0 1 0 (the nearest legal neighbor). University of Delaware CPEG 419
Error Correcting Code But this code 0 1 1 0 1 1 is received Suppose that this code is 0 1 0 1 0 Then you know an error occurred. But you are sure which code was actually sent. University of Delaware CPEG 419
Error Control • Mechanisms to detect and correct transmission errors. • Consider 2 types of errors: • Lost frame: frame is sent but never arrives. • Damaged frame: frame arrives but in error. • Error control: combination of error detection, feedback (ACK or NACK) from receiver, and retransmission by source. • Coupled with flow control feedback. University of Delaware CPEG 419
ARQ • ARQ: automatic repeat request. • Works by creating a reliable data link from an unreliable one. • 3 versions: • Stop-and-wait ARQ. • Go-back-N ARQ. • Selective-reject ARQ. University of Delaware CPEG 419
Stop-and-Wait ARQ • Single outstanding frame at any time. • Simple but inefficient. • Use of timers to trigger retransmission of data or ACKs. • 2 types of errors: • Damaged or lost frame. • Damaged or lost ACK. • Sequence numbers alternate between 0 and 1. University of Delaware CPEG 419
Stop-and-Wait ARQ: Example Frame 0 Sender Receiver ACK1 Frame 1 ACK 0 Frame 0 Timeout Frame 0 ACK 1 Timeout Frame 0 B discards duplicate. ACK 1 University of Delaware CPEG 419
Go-Back-N ARQ • Variation of sliding window for error control. • Allows a window’s worth of frames to be in transit at any time. • RR: ack’s receipt of frame. • REJ: negative acknowledgment indicating the frame in error. • Destination discards frame in error plus subsequent frames. University of Delaware CPEG 419
Go-Back-N ARQ Example S f0 R R S f7 f1 f0 Time out rr0 f2 f1 rr3 f3 rr(P bit =1) f4 rr4 f5 rr2 f6 Error f2 f7 rej5 Discarded f5 5, 6, 7 rexm. f6 rr6 f7 University of Delaware CPEG 419
Go-Back-N ARQ Issues • For k-bit sequence number, maximum window size is (2k-1). • If window size is too large, ACKs may be ambiguous: not clear if ACK is a duplicate ACK (errors occurred). • Example: 3-bit sequence number and 8 -frame window. • Source transmits f0, gets back rr1, then sends f1--f0, and gets back another rr1. ??? University of Delaware CPEG 419
Selective-Reject ARQ • Only frames transmitted are the ones that are NACK’ed (SREJ) or that timeout. • More efficient than Go-Back-N regarding amount of retransmissions. • But, receiver must buffer out-of-order frames. • More restriction on maximum window size; for k-bit sequence #’s, 2k-1 window. University of Delaware CPEG 419
Example Data Link Layer Protocol • High-Level Data Link Control (HDLC) • Widely-used (ISO standard). • Single frame format. • Synchronous transmission. University of Delaware CPEG 419
HDLC: Frame Format • Flag: frame delimiters (01111110). • Address field for multipoint links. • 16-bit or 32-bit CRC. • Refer to book (pages 176-185) for more details. flag address flag control data FCS 8 bits 8 ext. 8 or 16 8 variable 16 or 32 University of Delaware CPEG 419
Other DLL Protocols 1 • LAPB: Link Access Procedure, Balanced. • Part of the X.25 standard. • Subset of HDLC. • Link between user system and switch. • Same frame format as HDLC. • LAPD: Link Access Procedure, D-Channel. • Part of the ISDN standard. University of Delaware CPEG 419
Other DLL Protocols 2 • LLC: Logical Link Control. • Part of the 802 protocol family for LANs. • Link control functions divided between the MAC layer and the LLC layer. • LLC layer operates on top of MAC layer. Dst. MAC addr LLC ctl. Src. MAC addr Dst. LLC addr Src. LLC addr MAC control Data FCS University of Delaware CPEG 419
Other DLL Protocols 3 • SLIP: Serial Line IP • Dial-up protocol. • No error control. • Not standardized. • PPP: Point-to-Point Protocol • Internet standard for dial-up connections. • Provides framing similar to HDLC. University of Delaware CPEG 419
Multiplexing • Sharing a link/channel among multiple source-destination pairs. • Example: high-capacity long-distance trunks (fiber, microwave links) carry multiple connections at the same time. MUX DEMUX . . . . . . University of Delaware CPEG 419
Multiplexing Techniques • 3 basic types: • Frequency-Division Multiplexing (FDM). • Time-Division Multiplexing (TDM). • Statistical Time-Division Multiplexing (STDM). University of Delaware CPEG 419
FDM 1 • High bandwidth medium when compared to signals to be transmitted. • Widely used (e.g., TV, radio). • Various signals carried simultaneously where each one modulated onto different carrier frequency, or channel. • Channels separated by guard bands (unused) to prevent interference. University of Delaware CPEG 419
FDM 2 University of Delaware CPEG 419