Network Layer4-1 Lower limit on the number of check bits r We want to design a code m with m message bits and r check bits Allowing all single errors to be corrected m This requirement becomes m This put a lower limit on the number of check bits Needed to correct a single error
Network Layer4-2 Error correcting code: Hamming code r A data bit in position k m is checked by just those check bits occurring in its expansion
Network Layer4-3 Use of Hamming code to correct burst errors
Network Layer4-4 Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit errors 0 0
Network Layer4-5 Error detecting codes r Cyclic Redundancy Check (CRC) m is in widespread use, and called polynomial code treats bits as 0 and 1 coefficients of polynomials –For example: represents x 5 +x 4 + x 0 m Sender and receiver agree upon a generator polynomial G(x) To compute the checksum for some frame of m bits M(x) => append a checksum to the end of frame –such that polynomial is divisible by G(x) Receiver divides check-summed frame by G(x) –If there is a remainder => there has been an error
Network Layer4-6 Checksumming: Cyclic Redundancy Check r view data bits, D, as a binary number r choose r+1 bit pattern (generator), G r goal: choose r CRC bits, R, such that m exactly divisible by G (modulo 2) m receiver knows G, divides by G. If non-zero remainder: error detected! m can detect all burst errors less than r+1 bits r widely used in practice (Ethernet, WiFi, ATM)
Network Layer4-7 Algorithm for computing the checksum r Let r be the degree of G(x) m Append r zeros to the low-order end of the frame m => x r M(x) r Divide the bit string corresponding to G(x) m Into the bit string corresponding x r M(x) using Modulo 2 division r Subtract the remainder from x r M(x) m The result is the checksumed frame to be transmitted
Network Layer4-8 Error detecting codes: example Calculation of the polynomial code checksum.
Network Layer4-9 CRC Example Want: D. 2 r XOR R = nG equivalently: D. 2 r = nG XOR R equivalently: if we divide D. 2 r by G, want remainder R R = remainder[ ] D.2rGD.2rG
Network Layer4-10 Link Layer r 5.1 Introduction and services r 5.2 Error detection and correction r 5.3Multiple access protocols r 5.4 Link-layer Addressing r 5.5 Ethernet r 5.6 Link-layer switches r 5.7 PPP r 5.8 Link Virtualization: ATM, MPLS
Network Layer4-11 Multiple Access Links and Protocols Two types of “links”: r point-to-point m PPP for dial-up access m point-to-point link between Ethernet switch and host r broadcast (shared wire or medium) m old-fashioned Ethernet m upstream HFC m wireless LAN shared wire (e.g., cabled Ethernet) shared RF (e.g., WiFi) shared RF (satellite) humans at a cocktail party (shared air, acoustical)
Network Layer4-12 Multiple Access protocols r single shared broadcast channel r two or more simultaneous transmissions by nodes: interference m collision if node receives two or more signals at the same time multiple access protocol r distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit r communication about channel sharing must use channel itself! m no out-of-band channel for coordination
Network Layer4-13 CSMA (Carrier Sense Multiple Access) CSMA: listen before transmit: If channel sensed idle: transmit entire frame r If channel sensed busy, defer transmission r human analogy: don’t interrupt others!
Network Layer4-14 CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA m collisions detected within short time m colliding transmissions aborted, reducing channel wastage r collision detection: m easy in wired LANs: measure signal strengths, compare transmitted, received signals m difficult in wireless LANs: received signal strength overwhelmed by local transmission strength r human analogy: the polite conversationalist
Network Layer4-15 Link Layer r 5.1 Introduction and services r 5.2 Error detection and correction r 5.3Multiple access protocols r 5.4 Link-layer Addressing r 5.5 Ethernet r 5.6 Link-layer switches r 5.7 PPP r 5.8 Link Virtualization: ATM, MPLS
Network Layer4-16 Multiple Access Links and Protocols Two types of “links”: r point-to-point m PPP for dial-up access m point-to-point link between Ethernet switch and host r broadcast (shared wire or medium) m old-fashioned Ethernet m upstream HFC m wireless LAN shared wire (e.g., cabled Ethernet) shared RF (e.g., WiFi) shared RF (satellite) humans at a cocktail party (shared air, acoustical)
Network Layer4-17 LANs structure r LANs m Use a multi-access channel as basis for communication Broadcast channel m Key issue Determine who gets to use the channel when –There is a competition for it m Medium Access Control protocols of data link layer Determines who goes next on a multi-access channel MAC sublayer is especially important in LANs
Network Layer4-18 Dynamic channel allocation in LANs and MANs r Work in this area based on 2 assumptions m Single channel Available for all communication m Collision assumption If 2 frames are simultaneously sent => collision A collided frame must be sent again later There are no errors other than those generated by collisions
Network Layer4-19 Multiple Access protocols r single shared broadcast channel r two or more simultaneous transmissions by nodes: interference m collision if node receives two or more signals at the same time multiple access protocol r distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit r communication about channel sharing must use channel itself! m no out-of-band channel for coordination
Network Layer4-20 MAC function: arbitration r Imagine trying to get thru an intersection m When all traffic light are out You all want to use the intersection But you had better use it one at a time cannot allow cars from every direction to enter intersection –At the same time without having serious collisions r Data frames can collide if devices send any time m During collision, LAN is unusable Not too different from a car crash in middle of an intersection r MAC arbitrate the use of physical medium m To avoid collisions or recover when they occur
Network Layer4-21 CSMA (Carrier Sense Multiple Access) CSMA: listen before transmit: If channel sensed idle: transmit entire frame r If channel sensed busy, defer transmission r human analogy: don’t interrupt others!
Network Layer4-22 CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA m collisions detected within short time m colliding transmissions aborted, reducing channel wastage r collision detection: m easy in wired LANs: measure signal strengths, compare transmitted, received signals m difficult in wireless LANs: received signal strength overwhelmed by local transmission strength r human analogy: the polite conversationalist
Network Layer4-23 CSMA with Collision Detection: operational description r A user who wishes to transmit m 1) listen to see if the channel is free. If channel is idle => it transmits Otherwise, keeps on listening until channel is free –Then transmits immediately (1-persistent) m 2) during transmission keeps listening to detect collisions If a collision is detected => stops transmission immediately –Quickly terminating saves time and bandwidth And wait a random time before goes back to step 1 r CSMA/CD is widely used on LANs (basis of Ethernet)
Network Layer4-24 CSMA/CD: animation
Network Layer4-25 CSMA/CD: conceptual model r at t 0, more than one station try to send => collision m Each station aborts its transmission, wait a random time m => model consists of alternating periods Of contention and transmission, –idle occurs when there is no work r If 2 stations start transmitting at time t 0 m How long will it take them to realize they are in collision?
Network Layer4-26 Collision detection r The min time to detect the collision m is the time it takes the signal to reach another station if a station does not hear a collision after this full time –Can it assume that it has seized the channel? –All other stations knew it was transmitting and not interfere r Worst case scenario m Time for signal to propagate between farthest stations is m At the most distant station decides to send It will sense the collision very fast But first station will not get the collision burst till after
Network Layer4-27 Contention period r In the worst case, a station cannot be sure m It has seized the channel until it has transmitted for Without hearing a collision
Network Layer4-28 Minimum length frame r Reason for having a min length frame m To prevent a station from completing transmission Before the first bit has reached the far end Where it may collide with another frame m When B detects collision It sends a 48 bit noise burst to let everyone know about it
Network Layer4-29 Minimum length frame (cont’d) r If a station tries to send a very short frame m It might happen that sender finishes sending Before the noise burst arrives at A frame must take more than to send –that transmission is still taking place when noise gets back r For a 10 Mbps LAN m with a max length of 2500 meters and 4 repeaters m The round trip delay = 50 microseconds m The small frame is 500 bits (at 10 Mbps, 1 bit take 100 ns) With some margin of safety this was added to 512 or 64 bytes
Network Layer4-30 Network speed impact r As network speed goes up m The min frame length must go up m Or the maximum cable length must come down r For a 250-meter LAN m Operating at 1 Gbps m The min frame size should be 640 bytes
Network Layer4-31 Binary backoff exponential algorithm r How is randomization done in case of collision? m After a collision, time is divided into discrete slots Whose length is set to 512 bit times or 51.2 microseconds m After the first collision Each station waits for 0 or 1 slots. –If both pick the same number => Each one picks between 0, 1, 2, or 3 slots –If collision again => pick from 0 to After i collisions a random # between 0 and 2 i -1 is chosen –After 10 collisions => number is frozen at 1023 slots –After 16 collisions => give up
Network Layer4-32 In-class exercise r Let A and B be 2 stations attempting to transmit on Ethernet m Each has a steady stream of frames ready to send A’s frame are numbered: A1, A2, … B’s are similarly #ered m Let T = 51.2 microseconds = exponential backoff unit r Suppose A and B simultaneously m attempt to send frame 1, collide and happen to choose backoff times –0.T and 1.T respectively, meaning A wins the race r B will attempt to retransmit B1 while A transmit A2
Network Layer4-33 In-class exercise (cont’d) r These first attempts will collide m but A backoffs for either 0xT or 1xT m While B backoffs for time equal to one of 0xT, …, 3xT r Give the probability that A wins m the second backoff race immediately after the first collision
Network Layer4-34 Ethernet performance r Ethernet uses CSMA/CD + binary exp. Backoff m If each station transmits during a contention slot With probability p m The probability A that some station acquires the channel In that same slot is A is maximized when p = 1/k, with A → 1/e as k → infinity –Where k is the # stations ready to transmit Probability that contention interval has exactly j slots in it
Network Layer4-35 Channel efficiency r The mean number of slots per contention interval r Since each slot has a duration m The mean contention interval, w, is r If the mean frame takes P sec to transmit
Network Layer4-36 Channel efficiency vs. # stations trying to send r F, frame length, bandwidth B m Cable length L, speed of propagation c, m e contentions per frame