Summary

This document is a lecture on computer networks, specifically focusing on the link layer, error detection methods, and various multiple access protocols. It provides definitions, examples, and brief explanations of core concepts in computer networking.

Full Transcript

Computer Networks Lecture #9 In the last lecture Introduction to Information-centric networking Today Introduction to the Link layer and LANs Error detection, correction Multiple access protocols Introduction to the Link layer and LANs Link layer : Introduction Terminology Nodes: h...

Computer Networks Lecture #9 In the last lecture Introduction to Information-centric networking Today Introduction to the Link layer and LANs Error detection, correction Multiple access protocols Introduction to the Link layer and LANs Link layer : Introduction Terminology Nodes: hosts / routers Links: communication channels that connect adjacent nodes along communication path wired, wireless, LANs Frame: layer-2 packet, encapsulate datagram Link layer has responsibility of transferring datagram from one node to physically adjacent node over a link Link layer : Context Datagram transferred by di erent link protocols over di erent types of links e.g., WiFi on the rst link, Ethernet on the next link, … Each link protocol provides di erent services e.g., may or may not provide reliable data transfer over links Transportation analogy Trip from Princeton to Lausanne Tourist : datagram Limo: Princeton to JFK Transport segment : Communication link Plane: JFK to Geneva Transportation mode : Link-layer protocol Travel agent : routing algorithm Train: Geneva to Lausanne fi ff ff ff Link layer services Framing, link access Encapsulate datagram into frame / adding header, trailer Channel access if shared medium “MAC” addresses in the frame headers identify source, destination node (di erent from IP addresses) Reliable delivery between adjacent nodes We already know how to do this! Seldom used on low-bit error links Used in wireless links : High error rates Why are both link-level and end-to-end reliability mechanisms used? ff Link layer services Flow control Pacing between adjacent sending and receiving nodes Error detection Error caused by signal attenuation, noise Receivers 1) detect errors, 2) retransmit signals, or 3) drop frames Error correction Receivers identify and correct bit error(s) without retransmission Half-duplex / Full-duplex With half-duplex, nodes at both ends can transmit, but not at the same time Where is the link layer implemented? In each and every host Link layer is implemented in Network Interface Card (NIC) or on a chip Ethernet, WiFi card or chip Implements link, physical layer Attaches into host’s system bus Combination of hardware, software, rmware fi Interfaces communicating Sending side Receiving side Encapsulates datagram in frame Checks errors, reliable data transfer, ow control, etc Adds error checking bits, reliable data transfer, ow control, etc. Extracts datagram, passes to upper later fl fl Error detection, correction Error detection Error detection is not 100% reliable Protocol may miss some errors, but rarely Larger EDC eld yields better detection and correction EDC Error detection and correction bits (e.g., redundancy) D Data protected by error checking May include header elds fi fi Parity checking Single bit parity Two-dimensional bit parity Detect a single bit error Detect & correct single bit error e.g.) Even parity : set parity bit so there is an even number of 1’s Recap: Internet checksum Goal - Detect errors (i.e., ipped bits) in transmitted segment Sender e.g., Treat contents of UDP segment (including UdP header elds and IP addresses) as sequence of 16-bit integers Checksum: addition (one’s complement sum) of segment content Checksum value is put into UDP checksum eld Receiver Compute checksum of received segment as Sender does Check if computed checksum equals checksum eld value Not equal: error detected / Equal: no error detected (But, there may be errors) fl fi fi fi Recap: Internet checksum Goal - Detect errors (i.e., ipped bits) in transmitted segment fl Recap: Internet checksum e.g., Add two 16-bit integers Note: when adding numbers, a carryout from the most signi cant bit needs to be added to the result fi Recap: Internet checksum e.g., Add two 16-bit integers Note: when adding numbers, a carryout from the most signi cant bit needs to be added to the result fi Cyclic Redundancy Check (CRC) More powerful error detection coding Terms D: data bits (given, think of these as a binary number) G: big pattern (generator), of r+1 bits (given) Choose r CRC bits, R, such that exactly divisible by G (mod 2) Receiver knows G in advance Divides by G. If non-zero remainder, error detected. Can detect all burst errors less than r+1 bits Widely used in practice (e.g., ethernet, 802.11 wi ) fi CRC example r We want R s.t. D*2 XOR R = nG Or equivalently, r → D*2 XOR R (XOR R) = nG (XOR R) r → D*2 = nG XOR R r Or equivalently, If we divide D*2 by G, we want a remainder R to satisfy r R = remainder [ D*2 / G ] Multiple access protocols Multiple access links, protocols Two types of “links” Point-to-point Point-to-pint link between ethernet switch and host PPP for dial-up access Broadcast (shared wire or medium) Old-fashioned ethernet Upstream HFC in cable-based access IEEE 802.11 wireless LAN, 4G/5G, satelite Multiple access protocols Single shared broadcast channel Two or more simultaneous transmissions by nodes → interference Collision if a node receives two or more signals at the same time Multiple access protocol Distributed algorithm that determines how nodes share channel, i.e., determines when a node can transmit Communication for channel sharing control must use channel itself No out-of-band channel for coordination Ideal multiple access protocol Given Multiple access channel of rate R bps Desirable Fully utilized: when a single node wants to transmit, it can send at the rate of R Fairly shared: when N nodes want to transmit, each can send at the average rate of R/N Fully decentralized No special node to coordinate transmissions No synchronization of clocks, slots Simple Three broad classes of MAC protocols Channel partitioning Divide channel into smaller “pieces” (time slots, frequency, code, etc.) Allocate piece to node for exclusive use Random access Channel not divided, allow collisions “Recover” from collisions “Taking turns” Nodes take turns, but nodes with more to send can take longer turns Channel partitioning: TDMA Time Division Multiple Access (TDMA) Access to channel in “rounds” Each station gets xed length slot (length = packet transmission time) in each round Unused slots go idle Example of 6 stations in LAN Slots 1, 3, 4 have packets to send Slots 2, 5, 6 idle fi Channel partitioning: FDMA Frequency Division Multiple Access (FDMA) Channel spectrum divided into frequency bands xed frequency band is assigned to each station Unused transmission time in frequency bands go idle Example of 6 stations in LAN Frequency bands 1, 3, 4 have packets to send Frequency bands 2, 5, 6 idle fi Random access protocols When a node has a packet to send Transmit at a full channel data rate of R No a priori coordination among nodes Two or more transmitting nodes → can create “collision” Random access MAC protocol speci es How to detect collision How to recover from collision (e.g., via delayed retransmissions) fi Random access protocols Example of random access MAC protocols ALOHA, slotted ALOHA CSMA, CSMA/CD, CSMA/CA SLOTTED ALOHA Assumptions All frames of the same size Time divided into equal size slots (time to transmit 1 frame) Nodes start to transmit only slot beginning If two or more nodes transmit via the same slot, all nodes detect collision Operation When a node obtains a fresh frame, transmits it in the next slot Why a probability p is applied? no collision: the node can send a new frame in the next slot collision: the node retransmit the frame in each subsequent slot with a probability p until success Slotted ALOHA Pros Cons A single active node can continuously Collisions, wasting slots transit at a full rate of channel Idle slots (for random backo ) Highly decentralized: only timing for slots need to be in sync Clock synchronization is required Simple Nodes may be able to detect collision in less than slot-duration, but … keep transmitting after detecting collisions ff Efficiency of slotted ALOHA E ciency Long-run fraction of successful slots (many nodes, all with many frames to send) Simple analysis N nodes with many frames to send Each transmits in a slot with a probability p N−1 Probability that a given node has success in a slot → p(1 − p) N−1 Probability that any nodes have a success in a slot → Np(1 − p) N−1 Find p* that maximizes Np(1 − p) ffi Efficiency of slotted ALOHA N−1 Find p* that maximizes Np(1 − p) = f(N) p* makes the derivative of f(N) equal to 0 → f′(N) = N(1 − p) N−1 + Np(N − 1)(1 − p)N−2 × (−1) N−2 = N(1 − p) {(1 − p) − p(N − 1)} (1 − p) − p(N − 1) = 1 − pN = 0 ∴ p = 1/N  Efficiency of slotted ALOHA Simple analysis At best, only 37% of time (channel) can be used for meaningful transmission N nodes with many frames to send Each transmits in a slot with a probability p N−1 Probability that a given node has success in a slot → p(1 − p) N−1 Probability that any nodes have a success in a slot → Np(1 − p) N−1 Find p* that maximizes Np(1 − p) N−1 N−1 With p*, Np*(1 − p*) = (1 − 1/N) N−1 For many nodes, take limit of (1 − 1/N) as N goes to in nity → 1/e (0.37) fi Pure ALOHA Unslotted ALOHA: simpler, no synchronization When a frame is generated, it is transmitted immediately Collision probability increases with no synchronization Frame sent at t0 can collide with other frames sent in [t0-1, t0+1] 2(N−1) N goes to in nity with p*, Np*(1 − p*) approximates to 1/(2e) (= 0.18). Even worse than slotted ALOHA fi Carrier Sense Multiple Access (CSMA) Simple CSMA Listen before transmit If channel is sensed idle, transmit an entire frame Don’t interrupt others If channel is sensed busy, defer transmission CSMA/CD CSMA with Collision Detection Collision is detected within a short time The polite conversationalist Colliding transmission is aborted, reducing channel wastage Collision detection is easy in wired, di cult with wireless ffi Collision in CSMA Collision can still occur with carrier sensing Propagation delay means that two nodes may not hear each other’s just-started transmission Collision Entire packet transmission time is wasted Distance & propagation delay play role in determining collision probability CSMA/CD CSMA/CD reduces amount of time wasted in collision Ethernet CSMA/CD algorithm Step 1) NIC receives datagram from network layer, create frame Step 2) If NIC senses channel If idle - start frame transmission If busy - wait until channel idle, then transmit Step 3) If NIC transmits entire frame without collision, NIC is done with the frame Step 4) If NIC detects another transmission while sending, abort and send jam signal Step 5) After aborting, NIC enters binary (exponential) backo m After m-th collision, NIC chooses K at random from {0, 1, 2,.., 2 -1} NIC waits K × 512 bit times, return to Step 2) More collisions: longer backo interval ff f Efficiency of CSMA/CD Tprop = max prop delay between two nodes Ttrans = time to transmit max-size frame 1 e ciency = → e ciency goes to 1 Tprop 1 + 5T - as Tprop goes to 0 trans - as Ttrans goes to in nity Better performance than ALOHA And simple, cheap, decentralized ffi ffi fi “Taking turn” MAC protocols Channel partitioning MAC protocol at high load - share channel e ciently and fairly, but… at low load - ine cient, e.g., with a single active node, 1/N bandwidth allocated and delay in channel access Random access MAC protocols at high load - collision overhead at low load - e cient, e.g., a single active node can fully utilize channel “Taking turn” protocols Look for best of both worlds! ffi ffi ffi “Taking turn” MAC protocols Polling Master node “invites” other nodes to transmit in turn Typically used with “dumb” devices Concerns Polling overhead Latency Single point of failure (master node) “Taking turn” MAC protocols Token passing Control token passed from one node to next sequentially Token message Concerns Token overhead Latency Single point of failure (token) Cable access network FDM, TDM, and random access Multiple downstream (broadcast) FDM channels: up to 1.6Gbps/channel Single CMTS transmits into channels → no multiple access problem Multiple upstream channels: up to 1Gbps/channel Multiple access: all users contend (random access) for certain upstream channel time slots Others are assigned in the manner of TDM Cable access network Data Over Cable Service Interface Speci cation (DOCSIS) FDM over upstream/downstream frequency channels TDM upstream: some slot assigned, some have contention Request for upstream slots in a random access manner Downstream MAP frame: assigns upstream slots fi Summary of MAC protocols Channel partitioning by time, frequency, or code Time division, frequency division, code division Random access (dynamic) ALOHA, Slotted ALOHA, CSMA, CSMA/CD, CSMA/CA Carrier sensing: easy in some technologies (e.g., wired), hard in others (e.g., wireless) CSMA/CD is used in ethernet CSMA/CA used in IEEE 802.11 Taking turns Polling from a master node, token passing Bluetooth, FDDI, token ring Questions?

Use Quizgecko on...
Browser
Browser