Computer Networks Week 03 Founda(on Communica(on Concepts College of Information Science and Engineering Ritsumeikan University
Agenda l Basic topics of electromagnetic signals: frequency, amplitude, degradation l Multiple devices sharing a single, limited medium: collision handling and multiplexing l Concepts of error detection and correction 2
Amplitude l Amplitude is the height of a wave, which can be voltage, current, or field intensity l In telecommunications, amplitude is usually measured as the average wave height l Amplitude modulation (AM) in radio signals is used, for example, in AM broadcast radio the amplitude of a fixed-frequency carrier wave is modulated (changed) by the signal being sent l Optical signals are usually sent using amplitude modulation
Frequency l Frequency is the number of waves per given time interval l Alternatively, the inverse is used the distance between waves, or wavelength l Frequency modulation (FM) in radio signals is used, for example, in FM broadcast radio The frequency of a fixed-amplitude carrier is modulated by the signal being sent
Signal Degradation l Degradation means a signal s quality is reduced as it moves through a medium l Over distance, the signal strength is reduced, which is called attenuation when a signal is attenuated too much relative to noise, it is no longer reliable: it has degraded l Occlusion (or obstruction) means a physical object is blocking a signal l Interference happens when nearby signals become mixed together, corrupting the signal
Multiplexing l Multiplexing means sending two or more signals through a single channel l Signals are encoded by analog or digital means before being transmitted l At the receiver, the signals must be decoded l One kind of multiplexing sends signals using different frequencies l Another kind breaks a signal into small parts, and sends different parts at different times parts from different signals are interleaved
Collisions l A collision happens when two or more devices attempt to use a single channel at the same time l When a collision happens, both devices are usually unable to transmit l Media Access Control (MAC), in the Data Link Layer, performs the task of handling collisions and allowing multiple devices to share a limited medium
CSMA/CD l Carrier Sense Multiple Access with Collision Detection (CSMA/CD) is one solution for handling collisions, used on Ethernet l When a device attempts to send a frame, it listens for a collision l If there is a collision, the device waits for a pseudo-random time before attempting to resend the frame l After a certain number of failed attempts, the device gives up, and the transmission fails
CSMA/CD l Very abbreviated flowchart for CSMA/CD Start Backoff routine: Wait a pseudorandom period of microseconds true Transmit if idle Collision detected true Attempts <16 false false The method used to detect depends on the physical and data-link layer implementation Transmission success Too many collisions
CSMA/CA l Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA) can be used to solve the collision problem l Before transmitting, a device listens and waits if the medium is busy l The sender may request a period of time to send, with a Request to Send (RTS) packet l A central controller device acknowledges the request with a Clear to Send (CTS) packet, giving the sender permission to transmit
CSMA/CA with RTS/CTS l Very abbreviated flowchart for IEEE 802.11 Start Backoff routine: Wait a pseudorandom period of microseconds false Transmit RTS if idle CTS received? Both CSMA/CD and CSMA/CA enter a backoff or wait routine if another device is already transmitting true Transmit frame Transmission success
Error Detection and Correction l Because digital data is discrete, it can be checked and even corrected l The correct value is determined by the transmitting party l The simplest form of correction is simple redundancy but that is not very efficient l Error detection and correction is handled in the Data Link layer at the bit level, and at the Transport layer for whole packets
Parity Bits l One simple way of checking data in a signal is to count the number of bits l The sender must have some way of telling the correct number of 1 bits and 0 bits l One parity bit per byte (or word) can check for errors, but not correct them l Multiple parity bits can be used redundantly to allow error correction
Block Parity Example (Message, Part 1) 1 1 0 0 1 1 0 1 1 0 1 0 1 1 0 0 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 0 0 0 0 1 0 1 1 1 0 0 0 0 1 0 1 1 1 1 0 0 1 1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0
Block Parity Example (Message, Part 2) 1 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 1 0 0 0 1 1 1 0 1 0 0 0 0 1 1 0 1 0 0 0 1 0 1 1 0 1 1 0 0 1 0 1 1 0 0 0 0 1 1 0 1 1 1 1 0 0 1 1
Checksums l A checksum performs arithmetic on the values of digits or bits transmitted and adds the result to the data sent l Examples of checksums are all around you l UPC checksums are based on multiplying every other digit by 3 and adding the result (UPC bar codes also have parity) l ISBN 10 codes have checksum values of 0 to 10 (where 10 is represented by the digit X) Note: ISBN 13 has a different checksum formula
ISBN 10 example l ISBN 4-563-01399-4 l 4*1 + 5*2 + 6*3 + 3*4 + 0*5 + 1*6 + 3*7 + 9*8 + 9*9 = l 4 + 10 + 18 + 12 + 0 + 6 + 21 + 72 + 81 = l 224 l 224 % 11 = 4
Transport Layer Checksums l Internet Checksum simply uses addition on each set of 16 bits (as an unsigned integer) and the final checksum is the one s complement l Cyclic Redundancy Check (CRC) is one type of checksum used in the Transport Layer l CRC uses simple XOR, multiplication, and division operations on each set of bits to encode and decode the data while checking for errors l A parity bit is an example of a single-bit CRC l CRC encoding does not make the data encrypted or secret; it is only for detecting errors
Cyclic Redundancy Check l Transmitter performs polynomial division to calculate an N-bit remainder (the CRC), which is appended to the data l When the same division is performed by the receiver (with CRC attached) the remainder will be zero if the data contains no errors l Division performed by exclusive-or between input and N+1-bit divisor, with MSbit set l Divisor shifted right so dividend and divisor MSbits are aligned l When dividend is zero, remainder is CRC
Cyclic Redundancy Check transmit 1 0 0 1 1 C R C divisor 1 1 0 1 1 0 0 1 divisor 1 1 0 1 1 0 0 divisor 1 1 0 1 1 0 1 0 divisor 1 1 0 1 1 1 1 divisor 1 1 0 1 remainder 0 1 1 receive 1 0 0 1 1 0 1 1 divisor 1 1 0 1 1 0 0 1 0 1 1 divisor 1 1 0 1 0 1 1 1 0 0 0 1 1 divisor 1 1 0 1 1 1 1 0 1 1 1 divisor 1 1 0 1 1 1 1 0 1 divisor 1 1 0 1 remainder OK 0 0 0
Hamming Distance l Hamming Distance is a form of error correction using special encoding to send values that are very different from each other l If one byte or word is wrong, the distance to the nearest correct byte or word in the set is the most probable value l The difference between data sent and expected data is known as the Hamming distance
Hamming Code l Is a way to mix parity and data bits to correct single-bit errors l Bits are numbered from 1 and each powerof-2 bit position becomes a parity bit for all bits whose binary number has that bit set l The sum of the bit numbers of any incorrect parity bit(s) identifies an incorrect bit Bit number 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Coded data p1 p2 d1 p4 d2 d3 d4 p8 d5 d6 d7 d8 d9 d10 d11 p16 d12 d13 d14 d15 bits p1 x x x x x x x x x x Parity Bit coverage p2 x x x x x x x x x x p3 x x x x x x x x x p4 x x x x x x x x p5 x x x x x
Conclusions l Signals are sent using basic principles of electromagnetic waves: amplitude and frequency l Media Access Control (MAC) allows several devices to share a medium that is limited to one signal at a time l Multiplexing allows many signals to be sent over a limited number of lines or channels l Errors must be detected and corrected using parity, checksums, or encoding methods such as Hamming Distance