z No Class Thursday 103 z Office hours























![CRC z. How to find V such that G exactly divides [M|V]? y. Divide CRC z. How to find V such that G exactly divides [M|V]? y. Divide](https://slidetodoc.com/presentation_image/fca58f3fe2abf9e8fc1817eafaab8538/image-24.jpg)

![CRC Performance and Generators z Instead of [M|V] we receiver [M|V] + E (E CRC Performance and Generators z Instead of [M|V] we receiver [M|V] + E (E](https://slidetodoc.com/presentation_image/fca58f3fe2abf9e8fc1817eafaab8538/image-26.jpg)





























- Slides: 55
z. No Class Thursday 10/3 z. Office hours: Tue 3: 15 -4 – W 12 -1 – Evans 315 University of Delaware CPEG 419 1
Data Link Layer z. Physical layer: sending signals over transmission medium. z. Data link layer: responsible for error-free (reliable) communication between adjacent nodes. z. Functions: flow control, error control, framing, fragmentation, and addressing (in multipoint medium). Chapter 6 EE/CS 450 Fall 99 2
Flow Control z. What is it? y. Ensures that transmitter does not overrun receiver: limited receiver buffer space. y. Receiver buffers data to process before passing it up. y. If no flow control, receiver buffers may fill up and data may get dropped. University of Delaware CPEG 419 3
Stop-and-Wait z Simplest form of flow control. y. Transmitter sends frame and waits. y. Receiver receives frame and sends ACK. y. Transmitter gets ACK, sends other frame, and waits. y. This continues until there are no more frames to send. z 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 4
Bandwidth Delay Product z z Suppose that the baud rate is 10 Mbaud/s. Suppose that there are 10 bits per symbol. Suppose that the propagation delay is 25 ms. How many bits can fill the wire? y. Baud rate * bits/symbol * delay = bits y 10 M*10*0. 06 = 2500000 bits (2. 5 Mb)! y. This is bandwidth * delay = bandwidth delay product. z. 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 5
Transmission Delay z Suppose the data rate is 100 Mbps. z Suppose the frame is 1500 bytes. z 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 25 ms? University of Delaware CPEG 419 6
Sliding Window 1 z. Allows multiple frames to be in transit at the same time. z. Receiver allocates buffer space for n frames. z. Transmitter is allowed to send n (window size) frames without receiving ACK. z. Frame sequence number: labels frames. University of Delaware CPEG 419 7
Sliding Window 2 z. Receiver ack’s frame by including sequence number of next expected frame. z. Cumulative ACK: ack’s multiple frames. z. 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 8
Sliding Window 3 z. Sender maintains sequence numbers it’s allowed to send; receiver maintains sequence number it can receive. These lists are sender and receiver windows. z. Sequence numbers are bounded; if frame reserves k-bit field for sequence numbers, then they can range from 0 … 2 k -1 and are modulo 2 k. University of Delaware CPEG 419 9
Sliding Window 4 z. Transmission window shrinks each time frame is sent, and grows each time an ACK is received. University of Delaware CPEG 419 10
Example University of Delaware CPEG 419 11
Sliding Window (cont’d) z. RR (ready to receive) n acknowledges up to frame n-1. z. There is also RNR n, which ack’s up to frame n-1 but no longer accepts more frames. z. RNR shuts down the receive window and consequently the transmission window. z. Need subsequent RR to re-open window. University of Delaware CPEG 419 12
Piggybacking z. When both endpoints transmit, each keeps 2 windows, transmitter and receiver windows. z. Each send data and need to send ACKs. z. When sending data, transmitter can “piggyback” the acknowledgment information. z. When no data, send just the ACK. University of Delaware CPEG 419 13
Duplicate ACKs z. When no data, must re-send last ACK. z. Duplicate ACKs: report potential errors. University of Delaware CPEG 419 14
Error Detection z. Transmission impairments lead to transmission errors: change of 1 or more bits in transmitted frame. z. Transmission errors defined using probabilities: transmission medium modeled as a statistical system. University of Delaware CPEG 419 15
Error Probabilities 1 z. Definitions: y. Pb probability of single bit error (bit error rate); constant and independent for each bit. y. P 1 probability frame received with no errors. y. P 2 probability frame received with 1 or more undetected errors. y. P 3 probability frame received with 1 or more detected bit errors, but no undetected ones. University of Delaware CPEG 419 16
Error Probabilities 2 z. If no error detection mechanism, P 3 = 0. z. P 1 = (1 - Pb)F and P 2 = (1 - P 1), where F is size of frame in bits. z. P 1 decreases as Pb increases. z. P 1 decreases as F increases. University of Delaware CPEG 419 17
Example z 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. y. In a day, 5. 529 x 106 frames transmitted. y. Required frame error rate of 1/ 5. 529 x 106, or P 2 = 0. 18 x 10 -6. y. But Pb = 10 -6, so P 1 = (1 -Pb)F = 0. 999 and P 2 = 1 - P 1 = 10 -3, which is >>> required P 2 University of Delaware CPEG 419 18
Error Detection Schemes z. Transmitter adds additional bits for error detection. z. Transmitter computes error detection bits as function of original data. z. Receiver performs same calculation and compares results. If mismatch, then error. z. P 3 probability error detection scheme detects error; P 2 residual error rate or probability error goes undetected. University of Delaware CPEG 419 19
Parity z. Simplest error detection scheme. z. Append parity bit to data block. z. Example: ASCII transmission y 1 parity bit appended to each 7 -bit ASCII character. y. Even parity: 8 -bit code has even number of 1’s. y. Odd parity: 8 -bit code has odd number of 1’s. University of Delaware CPEG 419 20
Parity Check z. Example: transmitting ASCII “G” (1110001) using odd parity. y. Code transmitted is 11100011. y. Receiver checks received code and if odd number of 1’s, assumes no error. y. Suppose it receives 11000011, then detects error. y. NOTE: If more than 2 bits in error, may not be detected. University of Delaware CPEG 419 21
ISDN Example - Continued z. BER = 10 -6. z. Frame errors might occur when two or more bit errors occur. Or, no frame error if no bit errors or one bit error. y 1 – ((1 -Pb)1000 + 1000*(1 -Pb)999*Pb)= 5 e-7 y. With no parity, the frame error prob. = 10 -3 University of Delaware CPEG 419 22
Cyclic Redundancy Check z CRC is one of the most effective and common error detecting schemes. z Represent frames as polynomials y. M= 1010001101 -> x 9+x 7+x 3+x 2+x 0 z Both source and destination use a generator polynomial G – r bits/r-1 degree polynomial z 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 23
CRC z. How to find V such that G exactly divides [M|V]? y. Divide xr. M by G. Set V = the remainder. y[M|V] = xr. M + V y[M|V]/G = (xr. M + V)/G = xr. M/G + V/G = S + 2 V/G. But in binary 2 is the same as zero. So [M|V] / G = S. University of Delaware CPEG 419 24
CRC Example z. Frame M 1010001101 = x 9+x 7+x 3+x 2+x 0. z. Pattern G 110101. z. Dividing (frame*25) by pattern results in 01110. z. Thus T 101000110101110. z. Receiver can detect errors unless received message Tr is divisible by G. University of Delaware CPEG 419 25
CRC Performance and Generators z Instead of [M|V] we receiver [M|V] + E (E is the error). z Burst errors – CRC detects bursts of length r or less. y a string of errors, with E = 0 … 0 1 X X 1 0 … y E(x) = xi(xk-1 + … + 1) where the burst length is k. y If G is degree k or greater and G has a 0 th 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 10 6 what is the frame error probability? University of Delaware CPEG 419 26
CRC Performance and Generators z. Burst Errors Continued y. 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) y. In general, for longer bursts, the prob. is ½r University of Delaware CPEG 419 27
CRC z Lastly, if G contains x+1 as a factor, and E has an odd number of bit, then G will not divide E. z In IEEE 802 x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x + 1 z CRC can be implemented in hardware with registers. z Problem: errors can occur in some pattern, so the probabilities are not quite right. University of Delaware CPEG 419 28
Error Correcting Codes z. Hamming distance between bit strings: y. The number of bits where the string differ y. XOR them and count the 1’s y 10100 10 0 0 1 1 0 = 2 – the distance is two. University of Delaware CPEG 419 29
Error Correcting codes z 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. z Do the same thing, but make it so the distance between any encoded n bit string is 2 d+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 30
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 31
Error Correcting Code Suppose that this code is 0 1 0 But this code 0 1 1 0 is received Then you know an error occurred, and you figure that was meant to be sent is the code 0 1 0 (the nearest legal neighbor). University of Delaware CPEG 419 32
Error Correcting Code Suppose that this code is 0 1 0 But this code 0 1 1 is received Then you know an error occurred. But you are sure which code was actually sent. University of Delaware CPEG 419 33
Error Control z. Mechanisms to detect and correct transmission errors. z. Consider 2 types of errors: y. Lost frame: frame is sent but never arrives. y. Damaged frame: frame arrives but in error. z. Error control: combination of error detection, feedback (ACK or NACK) from receiver, and retransmission by source. z. Coupled with flow control feedback. University of Delaware CPEG 419 34
ARQ z. ARQ: automatic repeat request. z. Works by creating a reliable data link from an unreliable one. z 3 versions: y. Stop-and-wait ARQ. y. Go-back-N ARQ. y. Selective-reject ARQ. University of Delaware CPEG 419 35
Stop-and-Wait ARQ z Single outstanding frame at any time. z Simple but inefficient. z Use of timers to trigger retransmission of data or ACKs. z 2 types of errors: y. Damaged or lost frame. y. Damaged or lost ACK. z Sequence numbers alternate between 0 and 1. University of Delaware CPEG 419 36
Stop-and-Wait ARQ: Example Sender Frame 0 ACK 1 Frame 1 ACK 0 Frame 0 Receiver Timeout Frame 0 ACK 1 University of Delaware CPEG 419 B discards duplicate. 37
Go-Back-N ARQ z. Variation of sliding window for error control. z. Allows a window’s worth of frames to be in transit at any time. z. RR: ack’s receipt of frame. z. REJ: negative acknowledgment indicating the frame in error. z. Destination discards frame in error plus subsequent frames. University of Delaware CPEG 419 38
Go-Back-N ARQ Example S f 0 f 1 f 2 rr 3 R S Time out f 3 f 4 rr 4 f 5 f 6 Error f 7 rej 5 Discarded f 5 5, 6, 7 f 6 rexm. rr 6 f 7 University of Delaware CPEG 419 R f 7 f 0 rr 0 f 1 rr(P bit =1) rr 2 f 2 39
Go-Back-N ARQ Issues z. For k-bit sequence number, maximum window size is (2 k-1). y. If window size is too large, ACKs may be ambiguous: not clear if ACK is a duplicate ACK (errors occurred). y. Example: 3 -bit sequence number and 8 frame window. x. Source transmits f 0, gets back rr 1, then sends f 1 -f 0, and gets back another rr 1. ? ? ? University of Delaware CPEG 419 40
Selective-Reject ARQ z. Only frames transmitted are the ones that are NACK’ed (SREJ) or that timeout. z. More efficient than Go-Back-N regarding amount of retransmissions. z. But, receiver must buffer out-of-order frames. z. More restriction on maximum window size; for k-bit sequence #’s, 2 k-1 window. University of Delaware CPEG 419 41
Example Data Link Layer Protocol z. High-Level Data Link Control (HDLC) y. Widely-used (ISO standard). y. Single frame format. y. Synchronous transmission. University of Delaware CPEG 419 42
HDLC: Frame Format flag address control 8 bits 8 ext. 8 or 16 data variable FCS 16 or 32 y. Flag: frame delimiters (01111110). y. Address field for multipoint links. y 16 -bit or 32 -bit CRC. y. Refer to book (pages 176 -185) for more details. University of Delaware CPEG 419 flag 8 43
Other DLL Protocols 1 z. LAPB: Link Access Procedure, Balanced. y. Part of the X. 25 standard. y. Subset of HDLC. y. Link between user system and switch. y. Same frame format as HDLC. z. LAPD: Link Access Procedure, D-Channel. y. Part of the ISDN standard. University of Delaware CPEG 419 44
Other DLL Protocols 2 z. LLC: Logical Link Control. y. Part of the 802 protocol family for LANs. y. Link control functions divided between the MAC layer and the LLC layer. y. LLC layer operates on top of MAC layer. Dst. MAC control addr Src. MAC addr Dst. Src. LLC Data LLC ctl. addr University of Delaware CPEG 419 FCS 45
Other DLL Protocols 3 z. SLIP: Serial Line IP y. Dial-up protocol. y. No error control. y. Not standardized. z. PPP: Point-to-Point Protocol y. Internet standard for dial-up connections. y. Provides framing similar to HDLC. University of Delaware CPEG 419 46
Multiplexing . . . University of Delaware CPEG 419 DEMUX . . . MUX z. Sharing a link/channel among multiple source-destination pairs. z. Example: high-capacity long-distance trunks (fiber, microwave links) carry multiple connections at the same time. 47
Multiplexing Techniques z 3 basic types: y. Frequency-Division Multiplexing (FDM). y. Time-Division Multiplexing (TDM). y. Statistical Time-Division Multiplexing (STDM). University of Delaware CPEG 419 48
FDM 1 z. High bandwidth medium when compared to signals to be transmitted. z. Widely used (e. g. , TV, radio). z. Various signals carried simultaneously where each one modulated onto different carrier frequency, or channel. z. Channels separated by guard bands (unused) to prevent interference. University of Delaware CPEG 419 49
FDM 2 University of Delaware CPEG 419 50
TDM 1 z. TDM or synchronous TDM. z. High data rate medium when compared to signals to be transmitted. University of Delaware CPEG 419 51
TDM 2 z. Time divided into time slots. z. Frame consists of cycle of time slots. z. In each frame, 1 or more slots assigned to a data source. U 1 U 2. . . 1 2. . . UN N 1 2 . . . N Time frame University of Delaware CPEG 419 52
TDM 3 z. No control info at this level. z. Flow and error control? y. To be provided on a per-channel basis. y. Use DLL protocol such as HDLC. z. Examples: SONET (Synchronous Optical Network) for optical fiber. z+’s: simple, fair. z-’s: inefficient. University of Delaware CPEG 419 53
Statistical TDM 1 z. Or asynchronous TDM. z. Dynamically allocates time slots on demand. z. N input lines in statistical multiplexer, but only k slots on TDM frame, where k < n. z. Multiplexer scans input lines collecting data until frame is filled. z. Demultiplexer receives frame and distributes data accordingly. University of Delaware CPEG 419 54
STDM 2 z. Data rate on mux’ed line < sum of data rates from all input lines. z. Can support more devices than TDM using same link. z. Problem: peak periods. y. Solution: multiplexers have some buffering capacity to hold excess data. y. Tradeoff data rate and buffer size (response time). University of Delaware CPEG 419 55