Multiplexing/MAC Malathi Veeraraghavan Univ. of Virginia • Outline • Types of links • Multi-access (shared single) link • Point-to-point link • Types of multiplexing techniques • Circuit-based multiplexing • Packet-based multiplexing 1 Purpose of multiplexing/MAC • To share link bandwidth 2 MAC • MAC: Medium Access Control or Media Access Control – Set of functions to support the sharing of a single link by multiple endpoints • MAC vs. Multiplexing (MUX) – The term "MAC" is used to describe sharing techniques on multi-access links – The term "multiplexing" is used to describe sharing techniques on point-to-point links 3 Types of links • Multi-access links – – – – Typically used to connect multiple hosts to a switch Cheaper than point-to-point links Host Host ...... Mostly used in wireless networks Sometimes in wired networks through hub • Point-to-point links Host Switch Host Switch – Typically used between switches – Increasingly typical between hosts and switches in wired networks (port costs are decreasing) Host Host 4 Analogy of a MULTI-ACCESS LINK - several driveways attached to one road Courtesy: http://mars.gmu.edu/dspace/bitstream/1920/2497/1/pca_608_23_16n.jpg 5 Recall our multiple-link network Point-to-point link Point-to-point link shared using MUX techniques Switch Host Host Switch Host Switch Host e.g., roadways network (an intersection is comparable to a switch) 6 Multi-access wireless link between hosts and switch Multi-access wireless link Host Switch Host Switch Host Host Switch 802.11 wireless access point Switch Equivalent to: Host Host ...... Host 7 Image courtesy: http://compnetworking.about.com Multi-access wireless link (cell phones) Base station/cell site Switch Switch Switch 8 Images courtesy of cnet.com and wikipedia Multi-access wired link between hosts and switch Multi-access wired link Host Switch Host Switch Ethernet hub Switch Host Host Recall a hub is a multipoint repeater from tasks/layers class notes: shared single-link network 9 Image courtesy: wikipedia Usage of links • Point-to-point links – Host-to-switch, or more generally endpoint-toswitch (e.g., telephone, video camera) – Switch-to-switch • Multi-access links – Endpoint-to-switch 10 Back to outline (status check) • Outline • Types of links • Multi-access link • Point-to-point link Types of multiplexing techniques • Circuit-based multiplexing • Packet-based multiplexing 11 Classification of Multiplexing/MAC techniques Multiplexing/MAC techniques Circuit-based multiplexing Position based: • space • time • frequency Each multiplexed data stream occupies a different position Packet-based multiplexing Packet header based: • header carries destination address Each multiplexed data stream consists of packets with headers carrying corresponding destination addresses 12 Circuit-based multiplexing • Frequency Division Multiplexing (FDM) – Called Wavelength Division Multiplexing (WDM) in the optical range • Time Division Multiplexing (TDM) • Space Division Multiplexing (SDM) – Each fiber in a fiber bundle 13 Frequency Division Multiplexing Signal 1 Signal 2 Signal 1 Signal 3 Signal 2 Signal 3 (a) The original signals (b) The signals modulated on to different carrier frequencies (c) The multiplexed signal Tanenbaum 14 Frequency Division Multiplexing (FDM) • Each communication session is assigned its own frequency for the session • A few control channels (frequencies) are set aside to allow users to send requests for frequencies for their communication sessions (these requests are called "call setup signaling protocol messages") • Frequencies are released upon completion of the session (with "call release signaling protocol messages") • Modulation technique determines the required carrier spacing (e.g., 30 kHz for analog cellular) and correspondingly the number of simultaneous sessions • Examples – Each broadcast radio and TV station is assigned a different carrier frequency – long-held “sessions” – Analog cellular systems: two frequencies are assigned – one for reception, another for transmission to each cellular caller 15 Time Division Multiplexing (TDM) • Each communication session is assigned time slots for its session on one or more frequencies • A few control channels (time slots) are set aside to allow users to use for signaling messages, i.e., to send requests for timeslots for their communication sessions • Timeslots are released upon completion of the session • Examples – Classroom being shared by multiple classes one after another in time – Digital cellular systems: US system has three users sharing one carrier frequency for a cellular call 16 Frequency and time: many practical systems are hybrid Carrier Time Hybrid FDM/TDM Frequency TDM Frequency Frequency FDM Time Time Basic principle of communication: Two regions in the time-frequency plane with equal areas can carry the same amount of information 17 Use of circuit-based multiplexing on different types of links • Multi-access wireless link – Cellular phones • Point-to-point links between switches 18 Use of FDM and TDM techniques on a multi-access link • FDM sharing on a multi-access link is referred to as FDMA (Frequency Division Multiple Access) • TDM sharing on a multi-access link is referred to as TDMA (Time Division Multiple Access) 19 Forward and reverse channels Reverse channels Switch Forward channels Switch Switch Base station/cell site 20 Images courtesy of cnet.com, wikipedia, google Example of FDMA scheme: Advanced Mobile Phone System (AMPS) • FDMA/FDD – Spectrum allocation by FCC: A and B allocations to different providers Reverse A Original B 825 Extended A A 824 825 Forward A B 845 B 870 AB A A 845 849 869 870 890 B AB 890 894 20MHz 666channels 30kHz 25MHz 832channels 30kHz 20 MHz is the width of the allocated band: 845-825 and 890-870 30 kHz is the per-channel bandwidth required for an AMPS phone call 21 Duplex techniques • Separates signals transmitted by base stations from signals transmitted by terminals – Frequency Division Duplex (FDD): use separate sets of frequencies for forward and reverse channels (upstream and downstream) – Time Division Duplex (TDD): same frequencies used in the two directions, but different time slots 22 Dimension of space • Reuse the frequencies used at a cell C at another cell D that is far enough from C 23 Hexagonal cell frequency plan • R D • • • • D: Distance between a base station and the nearest base station that uses the same channels R: Radius of a cell Reuse distance = D/R Channel plan: method of assigning channels to cells to guarantee a minimum reuse distance between cells that use the same channel S/I: Signal to Interference Ratio D D S S which is the minimum reuse distance for which R R req I I req 24 Reuse factor (frequencies are reused every N cells) • Divide the set of available channels into N groups • N: reuse factor; select N such that cells assigned the same frequencies will have a D:R ratio greater than (D:R)req • For hexagons, reuse factor N is given by 1 D 2 N 3 R req • Practical values of N – range from 3 to 21 – most commonly used: 7 (D/R = 4.6) 25 Different reuse patterns (factors) 26 Service provider A • • • • • Has a total of 832/2 = 416 channels Set aside 21 for control channels for each provider Therefore 416-21 = 395 traffic channels per provider Per cell, we can have 56 and 3/7 channels if N=7 Four cells are given 56 channels and three cells are given 57 channels 27 Practice: IS136 NA-TDMA • NA-TDMA is a hybrid FDMA/TDMA scheme • Therefore each frequency will have time slots that are shared by multiple calls • Typical: three calls share one frequency • NA-TDMA is three times as efficient • Same frequency allocation as for AMPS • Carriers are 30 kHz apart - Bandwidth 28 The TDMA aspect: frames and time slots base station to mobile 6 1 2 3 4 5 6 1 2 3 4 45 MHz or 80 MHz mobile to base station 6 1 2 3 4 5 6 1 2 3 4 5 40ms • Every frame is 40ms long and consists of 6 time slots 29 What data (transmission) rate can be used at each carrier frequency? • • • • Each time slot carries 324 bits There are 6 timeslots/frame 1 frame is 40ms Therefore, data rate per carrier (frequency) is: 324bits / timeslot 6timeslots / frame 48.6kb / s 40ms / frame 30 Data rate of a carrier (frequency) • Voice calls in NA-TDMA – – – – – Speech codec rate: 7.95kbps Channel coding rate: 13kbps Fits within 16.2kbps One voice call needs two timeslots per frame So three calls can be carried at each carrier frequency 31 Use of circuit-based multiplexing on different types of links • Multi-access wireless link – Cellular phones Point-to-point links between switches 32 Techniques used in practice today • Time-division multiplexing – Plesiochronous Digital Hierarchy (PDH) • DS0, DS1, DS3 (one phone call: DS0) – Synchronous Optical Network (SONET) - US – Synchronous Digital Hierarchy (SDH) - others • Wavelength-division multiplexing (on fiber) 33 Time Division Multiplexing: The T1 carrier (1.544 Mbps) Input links Output link 1 2 . . 24 1 2 24 ........... 8 bits every 125s 8 * 24 + 1 = 193 bits every 125s RATE: ? RATE: ? Round-robin cycle through and transmit 8 bits each from input 1 through 24 onto output link and then start again from input 1 34 North American Digital Multiplexing Hierarchy 1 DS1 signal, 1.544Mbps Mux 24 1 DS2 signal, 6.312Mbps 24 DS0 4 DS1 Mux 4 1 7 DS2 DS3 signal, 44.736Mpbs Mux 7 • • • • • DS0, DS1, DS2, DS3, DS4, 64 kbps channel 1.544 Mbps channel (T1) 6.312 Mbps channel 44.736 Mbps channel (T3) 274.176 Mbps channel 1 6 DS3 Mux 6 DS4 signal 274.176Mbps 35 Synchronous Transport Signal (STS-1) Frame 90 columns 90 x 9 = 810 bytes 810 x 8 bits/125 sec = 51.84Mbps STS-1 rate = 51.84Mbps Byte Byte 1 Order of 2 transmission 9 rows SPE is 87 columns Frame period = 125 sec Overhead (3 columns): error detection bits, etc. Line overhead + Section overhead Payload called Synchronous Payload Envelope (SPE) Path overhead: one column inside SPE 36 SONET/SDH rates (number is the multiplier) Optical Carrier How many bits are carried within a single SONET frame of an OC48 signal? How many bits of the above number can be used to carry user data (payload)? Verify that the SPE data rate in the table above is correct for the OC48 signal. 37 Tanenbaum Back to outline (status check) • Outline • Types of links • Multi-access link • Point-to-point link • Types of multiplexing techniques • Circuit-based multiplexing Packet-based multiplexing 38 Packet-based multiplexing • For point-to-point links – Scheduling techniques • For multi-access links – Random access MAC schemes 39 Packet-based multiplexing on a point-to-point link Scheduling algorithms: FCFS, priority Header Data payload A Packetbased multiplexer B Output link C Input links Packet: a string of bits Payload: user-data bits being sent Header: overhead added by protocol 40 Packet buffering • Buffers hold packets waiting to be transmitted on output link – FCFS: Single buffer – Priority: As many buffers as there are priority classes • When the transmitter is ready to choose the next packet for transmission – FCFS: Select next packet in line if buffer is non-empty – Priority: Check buffers in order of priority and transmit packet from the first non-empty buffer 41 Rules for order of packet transmission • If a packet P arrives when the transmitter is free, and all buffers are empty, then the packet will be transmitted immediately. Add packet transmission time to packet arrival time to determine packet departure time. • If a packet P arrives into a buffer while another packet Q is being transmitted, packet P is served only after – Packet Q is fully transmitted (non-preemption), and – Higher-or-equal priority packets that are already in the buffers are transmitted. – Based on scheduling discipline, and the number of packets ahead of packet P in the buffers, determine departure time for P. 42 Examples of packet multiplexing • Point-to-point links between switches • Point-to-point link between endpoint and switch 43 Packet-based multiplexing on a point-to-point link between switches Switch Host 2 Host 1 input link Host 3 input link output link Packet-based multiplexer Switch Host 4 44 Packet-based multiplexing on a point-to-point link between switches Switch Host 2 Host 1 App. 2 App. 2 Switch Host 3 Host 4 App. 1 App. 1 Two communication sessions sharing this switch-to-switch link 45 Packet-based multiplexing on a point-topoint link between a host and a switch Host 1 App. 2 Packet-based multiplexer Host 2 App. 3 App. 2 Switch Host 3 Switch Host 4 App. 3 46 Packet-based multiplexing on a point-topoint link between a host and a switch Host 1 App. 2 Host 2 App. 3 App. 2 Switch Host 3 Host 4 App. 3 Two communications sessions sharing this host-to-switch link 47 Back to outline (status check) • Outline • Types of links • Multi-access link • Point-to-point link • Types of multiplexing techniques • Circuit-based multiplexing • Packet-based multiplexing o For point-to-point links - Scheduling techniques For multi-access links - Random access schemes 48 Random access MAC protocols • No reservations are made; instead a host just sends data packets • What can happen? – Collision (recall multi-access) • Need to avoid collisions or detect collisions and retransmit – What’s the cost of being too careful to avoid collisions? • Utilization will be sacrificed 49 Analogy of a MULTI-ACCESS LINK: a car pulls up to a road; driver looks right/left before entering - called "carrier sensing" Courtesy: http://mars.gmu.edu/dspace/bitstream/1920/2497/1/pca_608_23_16n.jpg 50 Random-access MAC (packet based sharing on multi-access links) • • • • ALOHA: just send & wait for ACK Slotted ALOHA: send in slots CSMA: sense carrier, but wait for ACK CSMA/CD: detect collisions instead of waiting for ACK • CSMA/CA 51 ALOHA • Simplest scheme • True free-for-all. When a node needs to send, it does so. It listens for an amount of time equal to the maximum round trip delay plus a fixed increment. If it hears an acknowledgment, fine; otherwise it resends after waiting a random amount of time. After several attempts, it gives up. • Low delay if light load • Max. utilization: 18% 52 Slotted ALOHA • All frames are of same size L • If link rate is C, time is divided into slots of size L/C (a slot equals the time to transmit one frame) • Nodes can transmit frames only at the beg. of slots • Nodes are sync’ed so each node knows when slots start • If more than one node sends, all nodes detect the collision even before the slot ends • Vulnerable period is one-way prop. delay, not two-way as in ALOHA. So maximum throughput is double: 37%. From Kurose and Ross 53 CSMA • Carrier Sense Multiple Access – sense carrier – if idle, send • wait for ack – If there isn’t one, assume there was a collision, retransmit – if busy, wait • Vulnerable period: one tprop 54 Types of CSMA schemes • 1-persistent: – if busy, constantly sense channel – if idle, send immediately – if collision is detected, wait a random amount of time before retransmitting • Non-persistent: – – – – – • sense channel when station has a packet to send if busy, wait a random amount of time before sensing again; if idle, send immediately collisions reduced because sensing is not rescheduled immediately drawback: more delay p-persistent: combines 1-persistent goal of reduced idle channel time with the non-persistent goal of reduced collisions. – sense constantly if busy and the station needs to send a packet – if the channel is idle, transmit packet with probability p – with probability 1-p station waits an additional tprop before sensing again 55 CSMA/CD • CSMA/Collision Detection (CSMA/CD): – In CSMA, if collision occurs, need to wait until damaged frames have fully propagated. For long frames compared to propagation delay, this could lead to significant waste of capacity. So add collision detection. – Listen for collision and immediately suspend sending data if collision is detected. – Rule: Frames should be long enough to allow collision detection prior to the end of transmission 56 CSMA/CA: 802.11 • Why CA (Collision Avoidance) and not CD? – difficult to receive (sense collisions) when transmitting due to weak received signals (fading) – hidden station problem: • Two mutually far away stations A and C want to send to B. • At A and C, channel appears idle • But collision occurs at B 57 Kurose and Ross’ slides Random-access MAC protocols used in practice today • Multi-access link • Wired: Ethernet – CSMA/CD scheme • Wireless: IEEE 802.11 • Wireless and mobile networks class 58 Example of CSMA/CD: Ethernet Ethernet protocol: 1. Each station listens before it transmits. 2. If the channel is busy, it waits until the channel goes idle, and then it transmits. 3. If the channel is idle it transmits immediately. Continue sensing. 4. If collision is detected, transmit a brief jamming signal, then cease transmission, wait for a random time, and retransmit. • collision detection is not by waiting for an ACK 59 Collisions in Ethernet • • The collision resolution process of Ethernet requires that a collision is detected while a station is still transmitting. Assume: Maximum propagation delay on the bus is tprop. t0 A A Begins Transmission B A B Begins Transmission B t0+tprop- 60 Collisions in Ethernet t0+tprop A B Detects Collision B A A Detects Collision Just Before End of Transmission B t0+2tprop • Restrictions: Frame should be at least as long as 2tpropr, where r is the transmission rate of the link, and tprop is the max. one-way propagation delay 61 Exponential Backoff Algorithm • If a station is involved in a collision, it waits a random amount of time before attempting a retransmission. • The random time is determined by the following algorithm: • Set “slot time” to 2tprop. • After first collision wait 0 or 1 slot time. • After i-th collision, wait a random number between 0 and 2i-1 time slots. • Do not increase random number range if i=10. • Give up after 16 collisions. 62 Ethernet performance • max: maximum efficiency under heavy load conditions • S: length of frame; r: data rate max S r S t 2t prop e r prop e 2.718 • tprop: one-way propagation delay • e: average number of contention slots before success in getting the medium • 2tprop is contention slot • Frame length assumed to be fixed in deriving this formula; not true for Ethernet (approximation) 63 Ethernet frame format Dst. Src. Type Addr. Addr. 6 6 2 Example MAC address: 04-3C-5A-11-26-78 Type 0800 2 Data CRC 46-1500 4 IP datagram 46-1500 number of bytes Dst. Addr: Destination address (6-byte MAC address) Src. Addr: Source Address (6-byte MAC address) Type: What type of payload is being carried in frame - e.g., IP datagram: 0800 (hexadecimal) CRC: Cyclic Redundancy Code (Error detection) 64 Ethernet protocol support for DLL functions • Destination and source MAC address fields – for multiplexing • CRC – for error detection • No sequence numbers/ACK numbers – for error correction • Pause feature – for ON/OFF flow control (special control frame) 65 Summary Multiplexing/MAC schemes Types of links Multi-access wireless link Circuit-based multiplexing Cellular (FDMA/TDMA) Multi-access wired link Packet-based multiplexing IEEE 802.11 (WiFi) Ethernet hub Point-to-point switch-toswitch link PDH, SONET, WDM Ethernet switch Point-to-point endpoint-toswitch link Plain Old Telephone Service (POTS) (space division multiplexing) Ethernet Phone links from residences carry only one phone call and hence it is space-division multiplexing; DSL: new technology for multiplexing data with voice 66 Supplemental reading • Tanenbaum's 4th edition – Section 4.3.3 (The Ethernet MAC sublayer protocol) – Section 4.3.4 (The binary exponential backoff algorithm) • Leon-Garcia/Widjaja's 2nd edition – – – – – Section 4.1 (Multiplexing) Section 4.2.1 (SONET multiplexing) Section 5.7.1 (Statistical multiplexing) Section 6.4.1 (FDMA) Section 6.4.2 (TDMA) 67 Acknowledgment • Few of the slides in this talk are taken from A. Tanenbaum’s textbook web site and a few from A. Leon-Garcia and I. Widjaja’s textbook web site. 68