Medium Access Control Zhibin Wu Lecture Overview l

  • Slides: 45
Download presentation
Medium Access Control Zhibin Wu

Medium Access Control Zhibin Wu

Lecture Overview l l Introduction Random Access – – – l Aloha Slotted Aloha

Lecture Overview l l Introduction Random Access – – – l Aloha Slotted Aloha CSMA/CD CSMA/CA Scheduled Access – TDMA – Dynamic TDMA l Spread-Spectrum/CDMA

Medium Access Sublayer network Data link LLC MAC Link layer control Medium access control

Medium Access Sublayer network Data link LLC MAC Link layer control Medium access control physical l Medium access (MAC) sublayer is not relevant on point-to-point links l The MAC sublayer is only used in broadcast or shared channel networks l All communication entities “share” a common channel l Examples: – Wired networks: Ethernet LAN – Wireless & Mobile Networks: Satellite, Cellular, Wireless LAN, – Packet radio network?

Share a Channel Ideally Broadcast channel of rate R bps l 1. When one

Share a Channel Ideally Broadcast channel of rate R bps l 1. When one node wants to transmit, it can send at rate R. l 2. When M nodes want to transmit, each can send at average rate R/M

Random Access Protocols l Single channel shared by a large number of hosts l

Random Access Protocols l Single channel shared by a large number of hosts l No coordination between hosts l Control is completely distributed l Examples: ALOHA, CSMA/CD

Scenarios of ALOHA l A group of nodes trying to sending frames to a

Scenarios of ALOHA l A group of nodes trying to sending frames to a central node l Star-topology. l Not a complete solution for bi-directional communication – For half-duplex device, what if a data packet arrives while it is receiving?

Pure Aloha l In Pure Aloha, frames are transmitted at completely arbitrary times.

Pure Aloha l In Pure Aloha, frames are transmitted at completely arbitrary times.

Aloha Algorithm 1. Transmit whenever you have data to send 2. Listen to the

Aloha Algorithm 1. Transmit whenever you have data to send 2. Listen to the broadcast (probably a separate channel) – Because broadcast is fed back, the sending host can always find out if its packet was destroyed just by listening to the downward broadcast one round-trip time after sending the packet 3. If the packet was destroyed, wait a random amount of time and send it again – The waiting time must be random to prevent the same packets from colliding over and over again

Vulnerable Period l l Vulnerable period for the shaded frame is 2 t Note

Vulnerable Period l l Vulnerable period for the shaded frame is 2 t Note that if the first bit of a new packet overlaps with the last bit of a packet almost finished, both packets are totally destroyed. (No capture effect)

l l Analysis of Aloha Packet Arrival is Poisson Process P [k arrivals in

l l Analysis of Aloha Packet Arrival is Poisson Process P [k arrivals in t seconds] = l Let G be the total number of frames attempted in t seconds – P [k attempts in t seconds] = l Conditional successful probability for one attempt is : – P 0 = P [0 other attempts in 2 t seconds] =e-2 Gt l Set t as unit frame time Let S be the mean number of successful attempts S=GP 0=Ge-2 G S is optimum at G=1/2 S=1/2 e = 0. 184 l l

Slotted Aloha l Transmission of frames are synchronized slot by slot. l Channel feedback

Slotted Aloha l Transmission of frames are synchronized slot by slot. l Channel feedback about whether packet is received or not

Slotted Aloha (Continued) l l l Slotted ALOHA cuts the vulnerable period for packets

Slotted Aloha (Continued) l l l Slotted ALOHA cuts the vulnerable period for packets from 2 t to t. Time is slotted. Packets must be transmitted within a slot. Procedure 1. If a host has a packet to transmit, it waits until the beginning of the next slot before sending 2. Listen to the broadcast and check if the packet was destroyed 3. If there was a collision, wait a random number of slots and try to send again

Analysis of Slotted ALOHA l Packet Arrival is Poisson Process l P [k arrivals

Analysis of Slotted ALOHA l Packet Arrival is Poisson Process l P [k arrivals in t seconds] = l Let G be the total number of frames attempted in t seconds – P [k attempts in t seconds] = l Successful probability for each slot is : P [1 attempts in a t seconds slot] =Ge-Gt l Set Slot time t as unit time, then S=Ge-G l S is optimum at G=1 l S=1/e = 0. 368

Performance of ALOHA l l Throughput versus offered traffic for ALOHA systems The main

Performance of ALOHA l l Throughput versus offered traffic for ALOHA systems The main reason for poor channel utilization of ALOHA (pure or slotted) is that all stations can transmit at will, without paying attention to what the other stations are doing.

CSMA l Protocols in which stations listen for a carrier (i. e. , a

CSMA l Protocols in which stations listen for a carrier (i. e. , a transmission) and act accordingly are called carrier sense protocols. l There are several types of CSMA protocols: – Non-Persistent CSMA – 1 -Persistent CSMA – P-Persistent CSMA

Assumptions with CSMA Networks l Constant length packets l No errors, except those caused

Assumptions with CSMA Networks l Constant length packets l No errors, except those caused by collisions l No capture effect l Each host can sense the transmissions of all other hosts l The propagation delay is small compared to the transmission time

Propagation Delay A B C D l D only sense A’s transmission after a

Propagation Delay A B C D l D only sense A’s transmission after a propagation delay τ l If τ is larger than packet transmission time, there are too much time wastage. l CSMA in satellite communication? No. The size (length) of the network must be limited!

Non-persistent CSMA l To send data, a station first listens to the channel to

Non-persistent CSMA l To send data, a station first listens to the channel to see if anyone else is transmitting. l If so, the station waits a random period of time (instead of keeping sensing until the end of the transmission) and repeats the algorithm. Otherwise, it transmits a frame. l If a collision occurs, the station waits a random amount of time and starts all over again. Assumption: l propagation delay is a constant common to all nodes: – a is the ratio of propagation delay to packet transmission time

Analysis of Non-persistent CSMA Unsuccessful transmission period Successful transmission period a Y a 1

Analysis of Non-persistent CSMA Unsuccessful transmission period Successful transmission period a Y a 1 Busy period Idle period l S= U/(B+I) l B = Y + 1 + a , I = 1/G l U = e-a. G l FY(y)=P{no packet occur in an duration of a-y } = e-G(a-y) 1 Busy period Normalized Time a

Discussion of Collisions l What's the effect of signal propagation delay a? – The

Discussion of Collisions l What's the effect of signal propagation delay a? – The longer the delay, the more the collisions, and the worse the performance of the protocol. l How about zero propagation delay ? – There still exist chances of collisions. S = G/(1+G) l Is this protocol any better than ALOHA (both pure and slotted) ? – Yes, because both stations have the decency to desist from interfering with the third station's frame.

1 -persistent CSMA (Carrier Sense Multiple Access): 1. To send data, a station first

1 -persistent CSMA (Carrier Sense Multiple Access): 1. To send data, a station first listens to the channel to see if anyone else is transmitting. 2. If so, the station waits (keeps sensing it) until the channel becomes idle. Otherwise, it transmits a frame. 3. If a collision occurs, the station waits a random amount of time and starts all over again. l It is called 1 -persistent because the station transmits with a probability of 1 whenever it starts sensing the channel and finds the channel idle. (Greedy) l This protocol has worse channel utilization than non-persistent CSMA.

Tradeoff between Non-persistent and 1 -persistent l If B and C become ready in

Tradeoff between Non-persistent and 1 -persistent l If B and C become ready in the middle of A’s transmission, – 1 -Persistent: B and C collide – Non-Persistent: B and C probably do not collide l If only B becomes ready in the middle of A’s transmission, – 1 -Persistent: B succeeds as soon as A ends – Non-Persistent: B may have to wait

P-persistent CSMA l Assume channels are slotted l One slot = contention period (i.

P-persistent CSMA l Assume channels are slotted l One slot = contention period (i. e. , one round trip propagation delay) Algorithm l Sense the channel – If channel is idle, transmit a packet with probability p u u if a packet was transmitted, go to step 2 if a packet was not transmitted, wait one slot and go to step 1 – If channel is busy, wait one slot and go to step 1. – In other words, wait until idle and then transmit with probability p l Detect collisions – If a collision occurs, wait a random amount of time and go to step 1

Persistent and Non-persistent CSMA Comparison of the channel utilization versus load for various random

Persistent and Non-persistent CSMA Comparison of the channel utilization versus load for various random access protocols.

CSMA with Collision Detection CSMA/CD (Carrier Sense Multiple Access with Collision Detection) protocol further

CSMA with Collision Detection CSMA/CD (Carrier Sense Multiple Access with Collision Detection) protocol further improves ALOHA by aborting transmissions as soon as a collision is detected. The conceptual model: • To send data, a station first listens to the channel to see if anyone else is transmitting. • If so, the station waits until the end of the transmission (1 -persistent) or wait a random period of time and repeats the algorithm (nonpersistent). Otherwise, it transmits a frame. • If a collision occurs, the station will detect the collision, abort its transmission, waits a random amount of time, and starts all over again.

How to Detect Collision l Prerequisite: A node can listening while talking l Ethernet

How to Detect Collision l Prerequisite: A node can listening while talking l Ethernet cables Tx Rx

CSMA/CD Continued • CSMA/CD can be in one of three states: contention, transmission, or

CSMA/CD Continued • CSMA/CD can be in one of three states: contention, transmission, or idle • The minimum time to detect the collision is the time it takes the signal to propagate from one station to the other. • How long could the transmitting station be sure it has seized the network ? ( or 2 ? where is time equal to the full propagation) • Model the contention interval as slotted aloha with slot width 2

CSMA/CA l Wireless LAN l How can detect collision if you cannot listening while

CSMA/CA l Wireless LAN l How can detect collision if you cannot listening while talking? l Collision Avoidance – Random Backoff (instead of 1 -persistent) – RTS/CTS l CS no longer works well – Rules: u u carrier ==> do not transmit no carrier ==> OK to transmit – But the above rules do not always apply to wireless.

Problems with carrier sensing Hidden terminal problem Z Y W W finds that medium

Problems with carrier sensing Hidden terminal problem Z Y W W finds that medium is free and it transmits a packet to Z no carrier ===> / OK to transmit

Problems with carrier sensing Exposed terminal problem W Z is transmitting to W Z

Problems with carrier sensing Exposed terminal problem W Z is transmitting to W Z X Y Y will not transmit to X even though it cannot interfere Presence of carrier ===> / hold off transmission

Solving Hidden Node problem with RTS/CTS - listen RTS - wait long enough for

Solving Hidden Node problem with RTS/CTS - listen RTS - wait long enough for the requested station to respond with CTS - if (timeout) then ready to transmit CTS RTS Z X Y W - listen CTS - wait long enough for the transmitter to send its data listen RTS ==> transmitter is close to me listen CTS ==> receiver is close to me Note: RTS/CTS does not solve exposed terminal problem. In the example above, X can send RTS, but CTS from the responder will collide with Y’s data.

RTS/CTS exchange example SIFS DIFS Src Dest Frame RTS ACK CTS 352 304 µs

RTS/CTS exchange example SIFS DIFS Src Dest Frame RTS ACK CTS 352 304 µs 10 µs µs 8192 s 10 µs 304 10 µs µs NAV (RTS) NAV (CTS) l RTS + CTS + Frame + ACK exchange invoked when frame size is large l NAV (Network Allocation Vector) – NAV maintains prediction of future traffic on the medium based on duration information that is announced in RTS/CTS frames prior to actual exchange of data

Pros & Cons of Random Access l Advantages – – l Short delay for

Pros & Cons of Random Access l Advantages – – l Short delay for bursty traffic Simple (due to distributed control) Flexible to fluctuations in the number of hosts Fairness Disadvantages – – Low channel efficiency with a large number of hosts Not good for continuous traffic (e. g. , voice) Cannot support priority traffic High variance in transmission delays

Scheduled Access l TDMA l Dynamic TDMA l Widely used – – cellular, Wi-Fi

Scheduled Access l TDMA l Dynamic TDMA l Widely used – – cellular, Wi-Fi (Hyper. LAN), IEEE 802. 16 Wireless ATM

TDMA l Time Division Multiple Access

TDMA l Time Division Multiple Access

TDMA Continued l access to channel in "rounds" l each station gets fixed length

TDMA Continued l access to channel in "rounds" l each station gets fixed length slot (length = packet transmission time) in each round l unused slots go idle l example: 6 -station LAN, 1, 3, 4 have packets, slots 2, 5, 6 idle

Dynamic TDMA l In dynamic time division multiple access, a scheduling algorithm dynamically reserves

Dynamic TDMA l In dynamic time division multiple access, a scheduling algorithm dynamically reserves a variable number of timeslots in each frame to variable user data streams, based on the traffic demand of each user data stream. l Negotiations (beforehand) to determine how to allocate slots dynamically. TDMA Frame TDM Downlink D-TDMA Uplink Modem preamble S-ALOHA control Burst from Access Point -> Mobiles Burst from User A To Access Point User B User C

Summary of Scheduled Access Protocols l Avoid of contention/collision; better channel efficiency with a

Summary of Scheduled Access Protocols l Avoid of contention/collision; better channel efficiency with a large number of hosts l predetermined channel allocation l Need centralized control l Require global synchronization l Guard time period to protect slots l Delay?

Spread Spectrum and CDMA l What if not divide up the channel by time

Spread Spectrum and CDMA l What if not divide up the channel by time (as in TDMA), or frequency (as in FDMA)? Is collision inevitable? l Not if collision is no longer damaging! – Is there any way to decode bits garbled by other overlapping frames? CDMA based on Spread Spectrum l A new perspective to solve multiple access problems l Spread Spectrum is a PHY innovation, not a MAC technique. l CDMA encodes data with a special code associated with each user and uses the constructive interference properties of the special codes to perform the multiplexing.

Spread Spectrum l Idea – spread signal over wider frequency band than required –

Spread Spectrum l Idea – spread signal over wider frequency band than required – originally deigned to thwart jamming l Frequency Hopping – transmit over random sequence of frequencies – sender and receiver share… u u pseudorandom number generator seed

Spread Spectrum (cont) l Direct Sequence – for each bit, send XOR of that

Spread Spectrum (cont) l Direct Sequence – for each bit, send XOR of that bit and n random bits – random sequence known to both sender and receiver – called n-bit chipping code – 802. 11 defines an 11 -bit chipping code 1 0 Data stream: 1010 1 0 Random sequence: 01001011001 1 0 XOR of the two: 101110101001

Code Division Multiple Access (CDMA) l Multiplexing Technique used with spread spectrum l Start

Code Division Multiple Access (CDMA) l Multiplexing Technique used with spread spectrum l Start with data signal rate D – Called bit data rate l Break each bit into k chips according to fixed pattern specific to each user – User’s code l New channel has chip data rate k. D chips per second l E. g. k=6, three users (A, B, C) communicating with base receiver R l Code for A = <1, -1, 1> l Code for B = <1, 1, -1, 1, 1> l Code for C = <1, 1, -1, 1, 1, -1>

CDMA Example

CDMA Example

CDMA Explanation l Consider A communicating with base l Base knows A’s code l

CDMA Explanation l Consider A communicating with base l Base knows A’s code l Assume communication already synchronized l A wants to send a 1 – Send chip pattern <1, -1, 1> u l A wants to send 0 – Send chip[ pattern <-1, 1, 1, -1> u l A’s code Complement of A’s code Decoder ignores other sources when using A’s code to decode – Orthogonal codes

Topics Not Covered in This Lecture l Dynamic behavior of Aloha – Strict mathematical

Topics Not Covered in This Lecture l Dynamic behavior of Aloha – Strict mathematical analysis – Stabilize Aloha systems with channel feedback l Taking Turns MAC protocols – Token Ring l FDMA