► medium access control (MAC) is important when a shared medium is used to Medium Access Control communicate between stations ► MAC layer is important in LANs ► WANs typically use point-to-point links

Multiple Access protocols Ideal Multiple Access Protocol

► single shared broadcast channel Broadcast channel of rate R bps ► two or more simultaneous transmissions by nodes: interference 1. When one node wants to transmit, it can send at ™ collision if node receives two or more signals at the rate R. same time 2. When M nodes want to transmit, each can send multiple access protocol at average rate R/M ► distributed algorithm to share the 3. Fully decentralized: ► communication about channel sharing must use ™ no special node to coordinate transmissions channel itself! ™ no synchronization of clocks, slots ™ no out-of-band channel for coordination 4. Simple

1 System Model for Channel Channel Allocation Problem Allocation

► Approaches can be classified into two ► Station Model types: ► Single Channel Assumption ™ Static allocation schemes ► Collision Assumption ™ Dynamic allocation schemes ► Time ™ Continuous ™ Slotted

► Carrier sense ™ Present ™ Absent

Channel Partitioning MAC protocols: MAC Protocols: a taxonomy TDMA Three broad classes: TDMA: time division multiple access ► Channel Partitioning (static) ► access to channel in "rounds" ™ divide channel into smaller “pieces” (time slots, frequency, code) ► each station gets fixed length slot (length = ™ allocate piece to node for exclusive use pkt trans time) in each round

► Random Access (dynamic) ► unused slots go idle ™ channel not divided, allow collisions ► example: 6-station LAN, 1,3,4 have pkt, slots ™ “recover” from collisions 2,5,6 idle

► “Taking turns” (dynamic) ™ Nodes take turns, but nodes with more to send can take longer turns

2 Channel Partitioning MAC protocols: Channel Partitioning MAC protocols: FDMA FDMA FDMA: frequency division multiple access ► example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle ► channel spectrum divided into frequency bands time ► each station assigned fixed frequency band

► unused transmission time in frequency bands go idle frequency bands

► TDM (Time Division ): channel divided into N time slots, one per user; inefficient with low duty cycle users and at light load. ► FDM (Frequency Division Multiplexing): frequency subdivided.

Random Access Protocols Examples of Random Access

► When node has packet to send ► slotted ALOHA ™ transmit at full channel data rate R. ► ALOHA ™ no a priori coordination among nodes ► CSMA, CSMA/CD, CSMA/CA ► two or more transmitting nodes ➜ “collision”, ► random access MAC protocol specifies: ™ how to detect collisions ™ how to recover from collisions (e.g., via delayed retransmissions)

3 Slotted ALOHA Slotted ALOHA

Assumptions

► all frames same size

► time is divided into equal size slots, time to transmit 1 frame Pros Cons ► nodes start to transmit frames only at ► single active node can ► collisions, wasting slots beginning of slots continuously transmit at ► idle slots full rate of channel ► nodes may be able to ► nodes are synchronized ► highly decentralized: detect collision in less ► if 2 or more nodes transmit in slot, all nodes only slots in nodes need than time to transmit packet detect collision to be in sync ► clock synchronization ► simple

Slotted Aloha efficiency Pure ALOHA Efficiency is the long-run ► For max efficiency with fraction of successful slots N nodes, find p* that In pure ALOHA, frames are transmitted at when there are many nodes, maximizes each with many frames to send Np(1-p)N-1 completely arbitrary times. ► For many nodes, take ► Suppose N nodes with limit of Np*(1-p*)N-1 as N many frames to send, goes to infinity, gives each transmits in slot 1/e = .37 with probability p ► prob that node 1 has At best: channel success in a slot = used for useful p(1-p)N-1 transmissions 37% ► prob that any node has of time! a success = Np(1-p)N-1

4 Pure ALOHA… Pure Aloha efficiency P(success by given node) = P(node transmits) . ► unslotted Aloha: simpler, no synchronization P(no other node transmits in [t -1,t ]). ► when frame first arrives 0 0 P(no other node transmits in [t0,t0 +1]) ™ transmit immediately = p . (1-p)N-1 . (1-p)N-1 ► collision probability increases: = p . (1-p)2(N-1)

™ frame sent at t0 collides with other frames sent in [t0- Efficiency is given by P(success) for all nodes 1,t0+1] = N p . (1-p)2(N-1)

… choosing optimum p and then letting n -> infty ...

= 1/(2e) = .18

CSMA (Carrier Sense Multiple Performance of ALOHA Access)

Throughput versus offered traffic for ALOHA CSMA: listen before transmit: systems. If channel sensed idle: transmit entire frame

► If channel sensed busy, defer transmission

► Human analogy: don’t interrupt others!

5 Persistent and Nonpersistent CSMA Variants CSMA ► 1-persistent Comparison of the channel utilization ™ Station transmits with probability 1 if the channel is idle. If the channel busy, waits until idle. On collision, versus load for various random station waits a random amount of time. access protocols. ► Non persistent ™ If channel is busy, station does not continuously sense the channel. Waits random amount of time and repeats the algorithm ► P-persistent (slotted channels) ™ If channel idle, transmit with probability p. If channel busy, station waits until next slot and applies the algorithm

CSMA collisions CSMA/CD (Collision Detection) spatial layout of nodes collisions can still occur: CSMA/CD: carrier sensing, deferral as in CSMA propagation delay means ™ collisions detected within short time two nodes may not hear each other’s transmission ™ colliding transmissions aborted, reducing channel wastage collision: ► collision detection: entire packet transmission time wasted ™ easy in wired LANs: measure signal strengths, note: compare transmitted, received signals role of distance & propagation ™ difficult in wireless LANs: receiver shut off while delay in determining collision transmitting probability ► human analogy: the polite conversationalist

6 CSMA/CD collision detection CSMA/CD collision detection…

CSMA/CD can be in one of three states: contention, transmission, or idle.

Collision-Free Protocols Collision-Free Protocols…

The basic bit-map protocol. The binary countdown protocol. A dash indicates silence

7 “Taking Turns” MAC protocols “Taking Turns” MAC protocols Token passing: channel partitioning MAC protocols: Polling: ► control token passed from ™ share channel efficiently and fairly at high load ► master node “invites” slave nodes to one node to next sequentially. ™ inefficient at low load: delay in channel access, 1/N transmit in turn ► token message bandwidth allocated even if only 1 active node! ► concerns: ► concerns: Random access MAC protocols ™ polling overhead ™ token overhead ™ efficient at low load: single node can fully utilize ™ latency ™ latency channel ™ single point of failure ™ single point of failure (token) ™ high load: collision overhead (master) “taking turns” protocols look for best of both worlds!

8