Part 4 Medium Access Control 4 1 MAC






























- Slides: 30
Part 4 Medium Access Control 4. 1 MAC Sublayer - CSMA 4. 2 MAC Sublayer - Collision Free University of Calgary CS 441 1
4. 1 Data Link Layer - Medium Access Control MAC Data Link Sublayer Logical Link Control (LLC) Data Link layer Physical layer Medium Access Control (MAC) Physical layer University of Calgary CS 441 2
MAC Protocols - Two Basic Approaches • Scheduling + ready stations transmit on a schedule + wastes time/bandwidth when scheduled station does not need channel, current station could have sent immediately + stations are always guaranteed to get through on the predefined schedule • Random Access + ready stations transmit anytime + collisions can result when transmissions from different stations overlap + stations not guaranteed to get through (collisions may continue to occur) University of Calgary CS 441 3
Broadcast Networks • LANs + Ethernet - CSMA/ CD • LANs - token ring + FDDI + Domain + MAP/TOP • MANs + SONET • Satellite University of Calgary CS 441 4
Random Access Protocols - Variations • no carrier sensing - cannot see if line is in use + transmit any time + detect collisions via traditional error detection schemes (eg Nacks, timeouts) + eg, ALOHA, SLOTTED ALOHA • carrier sense multiple access - CSMA + sense if channel is busy, send if idle + collisions if 2 stations send at same time • CSMA / CD: with Collision Detection + sense if channel is busy or a collision occurs + stops sending if a collision is noticed + eg, IEEE 802. 3 University of Calgary CS 441 5
Sheduling Protocols - Variations • fixed assignment + station has designated time slot for sending + eg, TDMA: Time Division Multiple Access, each station assigned a specific time slot • stations 'reserve' a slot, then send via TDMA + good when more stations than available slots + arbitrary protocol can be used for reservations • central control (polling) + primary polls stations for data in sequence • distributed control + eg, token passing, station with token can transmit, IEEE 802. 4: Token Bus University of Calgary CS 441 6
Token Ring - Collision Free receiver xmitter Ring Interface receive buffer xmit buffer Station University of Calgary CS 441 7
MAC Protocol Assumptions • Stations + each 'station' asynchronously transmits frames + station blocked until transmission succeeds • Single Channel + all stations send and receive on one channel • Carrier Sensing + can detect if another station is transmitting • Collision + stations may be able to detect collisions • Time + continuous or slotted University of Calgary CS 441 8
1 -Persistent CSMA • stations detect if channel is in use + don't transmit if channel busy + expect fewer collisions than Aloha • transmit immediately when + channel is idle + after channel is busy • if a collision occurs, wait a random time + good at light loads as alway send immediately + poor at heavy loads due to many collisions University of Calgary CS 441 9
Non-Persistent CSMA • when ready and channel idle, transmit immediately, if busy wait a random time • wait a random time after a collision • better at moderate to high loads as collisions are less likely to occur • poorer at low loads as may defer unnecessarily University of Calgary CS 441 10
p - Persistent CSMA • defer transmission to next slot with probability p + if channel is busy or collision has occurred, repeats above step • with small p, excellent at heavy loads but wasted slots at light loads • as p increases approaches performance of 1 persistent protocol University of Calgary CS 441 11
Given n Stations Choose a Value for p • at end of transmission, expect number of stations to attempt transmission is n*p • if n*p > 1, will always be a collision (on average) + but probability of stations sending after collision is also n*p! + collisions continue, throughput drops to 0 • therefore must choose n*p < 1 for expected peak loads of n. • as p gets smaller + stations wait longer for transmission, but collisions reduced University of Calgary CS 441 12
CSMA / CD (Collision Detection) • sender listens to channel while sending + if collision detected, xmit noise burst and abort transmission + saves time and bandwidth • most commonly used protocol on LANs + originally developed by Xerox (ETHERNET), 1976 + standardized by IEEE 802. 3 (CSMA/CD protocols) University of Calgary CS 441 13
CSMA / CD • General algorithm + Do forever: - if channel idle, start transmitting frame - if collision detected during transmission • stop frame transmission • transmit brief jamming signal (makes sure all stations know about collision) • wait random time University of Calgary CS 441 14
Contention Period • period of time when a station starts transmitting before other stations know that the line is busy + other stations, thinking the line is idle, may contend (start transmitting) for the line + due to propagation delay A University of Calgary B CS 441 15
Length of Contention Period = 2 • worst case: longest delay before a collision is detected, let A, B be furthest apart stations = propagation delay between them A transmits at t, B transmits at t + (just before it detects the frame is busy) B detects collison, stops at t + it takes an additional seconds before A sees the collision and stops as well • propagation delay depends upon cable length and throughput speed (1 km ethernet ~ 5 s) University of Calgary CS 441 16
CSMA/ CD and Collisions • most CSMA/ CD protocols use a 1 -persisent protocol to handle collisions + examples - Ethernet - Mitre. Net - IEEE 802. 3 standard + although more collisons may occur, time to recover from them is shorter - as long as frames are long relative to propagation delay University of Calgary CS 441 17
Backoff Algorithms • retransmission delay after collision uses "binary exponential backoff" + adapts to load, reduces further chance of collision • eg 1 -persistent CSMA/CD + case Collision: /* sensed immediately */ - send jamming signal - wait_random exponential time - break; University of Calgary CS 441 18
Ethernet (CSMA/ CD) • developed by Xerox early 70's + commercialized mid/late 70's + de facto standard taken up and generalized as dejure standard IEEE 802. 3 • physical medium + baseband coax (thick and thin) + twisted pair (recent introduction) • length restrictions - thicknet: - 500 m max distance between repeaters - up to 4 repeaters - 2. 5 max length - restriction due to maximum limit of round-trip propagation delay of 51. 2 s University of Calgary CS 441 19
Length Restrictions cont’d • thinnet + 1/3 the distance is allowed between repeaters + ~800 meters maximum length of network • twisted pair + 200 feet max allowed from station to tranceiver/hub converter + most phone lines < 200 feet from connector box University of Calgary CS 441 20
Ethernet Physical Characteristics Continued • Tranceivers - electronics: + transmit/receive signals on channel + recognize presence of signals when other stations transmit + recognize "collisions" + up to 100 tranceivers on 2. 5 km network + stations can be installed on the fly without bringing the network down • Terminators + necessary to eliminate signal reflection at ends of the wire University of Calgary CS 441 21
CSMA / CD Frame Structure (IEEE 802. 3) • • • pre sd dest src lngth data pad fcs 7 1 2/ 6 2 var 4 Pre = preamble, 7 bytes = 56 bits sd = start delimiter dest, src = dest & src addresses, = 2 or 6 bytes lngth = length of data in bytes pad set so that data + pad is > some minimum, eg, 64 bytes, or 512 bits • fcs = frame (error) check sequence, CRC-32 University of Calgary CS 441 22
Address Fields IEEE 802. 3 • addresses - 16 bit version + 1 st bit specifies individual or group address • addresses - 48 bit version + 1 st bit specifies individual or group address 2 nd bit specifies if assigned locally (16, 000 addresses for each person on earth? ) • source address + unique address of transmitter + every ethernet board has a world-wide unique address University of Calgary CS 441 • 10 BASE clock rate is 10 Mb/s =. 1 s per bit 23
Ethernet: Control Procedures • defer - do not transmit if: + carrier present (manchester transitions) + within minimum spacing at end of frame • transmit - if not deferring + transmit until completed or collision detected • abort - if collision detected: + stop transmission + jam (4 -6 bytes) to insure all stations detect • retransmit - if collision detected: + wait random time - backoff algorithm - eg double delay with repeated collisions University of Calgary CS 441 24
Packet Size Issues - minimum packet size? • case 1: contention period << frame length + good throughput (as cost of collision is minimal) • case 2: contention period ~= frame length + equivalent to CSMA • case 3: contention period > frame length + sender may be able to transmit entire packet + but another sender, before seeing it, may transmit a frame and get a collision - sender will not detect the collision! - higher level protocol then necessary to detect collision University of Calgary CS 441 25
Packet Size Issues • receiver: + if frames are small, may not be able to detect collisions + if frame size > collision fragment size, this is easy + while error correction schemes will do this cannot distinguish between line state errors and errors due to collisions University of Calgary CS 441 26
Effective Throughput of Ethernet • e. g. , using an editor over Ethernet, where every character must be remotely echoed + 1 character per frame, assume light traffic - min frame length = 56 + 8 + 48 + 16 + 512 + 32 = 720 bits - packet spacing = 96 bits? - total = 816 bits for every 7 bit ascii character sent • effective throughput < 1 % = ~ 100 kb/ s + will be worse with heavy traffic & collisions! + will be better as data size increases University of Calgary CS 441 27
Ethernet Disadvantages • much analog circuitry for collision detection • minimum frame size of 64 bytes • no priorities assigned + cannot guarantee that a packet will be successfuly transmitted, real time people (eg manufacturing) do not like this • limited cable length + round trip delay determines slot time • has poor performance at high loads • does not scale well to high data rates + shorter frames within 2 contention interval implies less efficiency University of Calgary CS 441 28
Ethernet Advantages • widely used, good defacto commercial standard • simple algorithm, inexpensive implementation • can install new stations on the fly • stations can disconnect or fail without disruption • inexpensive standard interface on most computers • selectable scalability becoming available University of Calgary CS 441 29
Gigabit Ethernet • fibre with 1 Gb/s transmission rates + near current limit of electroics/optical interface • light on/ off for 1/ 0, respectively + 200 million meters / second + 1 nanosecond per bit + 0. 2 meters per bit • for 200 meter station distance & 1, 000 bit frame + 200 meter frame = 1 microsecond, a = 1 + best utilization = Tf / (Tf + ) = 1/ (1+a) = 50% + shorter frame or longer distance is worse • now have 10 -1000 Mb/s = 100 -10 -1 nanosec/bit University of Calgary CS 441 + does support standard selectable scalability 30