37
Medium Access Control NWEN302 Computer Network Design

Medium Access Control NWEN302 Computer Network Design

Embed Size (px)

Citation preview

Page 1: Medium Access Control NWEN302 Computer Network Design

Medium Access Control

NWEN302 Computer Network Design

Page 2: Medium Access Control NWEN302 Computer Network Design

Multiple Access Links

Two types of “links”:• point-to-point

– dial-up access– point-to-point link between

Ethernet switch/hub and host• broadcast (shared)

– shared wire, e.g. Ethernet, (upstream) HFC, Token Ring/Bus

– shared wireless, e.g. 802.11 WLAN, HiperLAN, WiMAX

© Winston Seah NWEN302 Computer Network Design

2

shared wire (e.g., cabled Ethernet)

shared RF (e.g., 802.11 WiFi)

humans at a party (shared air, acoustical)

Page 3: Medium Access Control NWEN302 Computer Network Design

Medium Access Control (MAC)• Distributed algorithm that determines how

nodes share channel, i.e., determine when node can transmit

• Communication about channel sharing must use channel itself!

no out-of-band (separate) channel for coordination

© Winston Seah NWEN302 Computer Network Design

3

Page 4: Medium Access Control NWEN302 Computer Network Design

MAC Protocols: a taxonomy• Channel Partitioning

– divide channel based on time, frequency, code– allocate portion to node for exclusive use

• Random Access– channel not divided, allow collisions– “recover” from collisions

• Ordered Access– nodes take turns– nodes with more to send can take longer turns– nodes with higher priority get more turns

© Winston Seah NWEN302 Computer Network Design

4

Page 5: Medium Access Control NWEN302 Computer Network Design

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1. when one node wants to transmit, it can send at

rate R.

2. when M nodes want to transmit, each can send at average rate R/M

3. fully decentralized:– no special node to coordinate transmissions– no synchronization of clocks, slots

4. simple

© Winston Seah NWEN302 Computer Network Design

5

Page 6: Medium Access Control NWEN302 Computer Network Design

Channel Partitioning MACs

TDMA: time division multiple access • access to channel in "rounds" • each station gets fixed length slot (length =

packet transmission time) in each round • unused slots go idle • E.g: 6-station LAN, Stations1,3,4 have packets,

slots 2,5,6 idle

© Winston Seah NWEN302 Computer Network Design

6

1 3 4 1 3 4

6-slotframe

Page 7: Medium Access Control NWEN302 Computer Network Design

Channel Partitioning MACs

FDMA: frequency division multiple access • channel spectrum divided into frequency bands• each station assigned fixed frequency band• unused transmission time in frequency bands go idle • E.g. 6-station LAN, Stations 1,3,4 have packets to

send, frequency bands 2,5,6 idle

© Winston Seah NWEN302 Computer Network Design

7

frequency

bands

time

FDM cable

12

3

4

5

6

Page 8: Medium Access Control NWEN302 Computer Network Design

Channel Partitioning MACs

Code Division Multiple Access (CDMA)• Unique “code” assigned to each user; i.e., code set

partitioning• all users use same frequency but each user has

own “chipping” sequence (code) to encode data• encoded signal = (original data) X (chipping

sequence)• decoding: inner-product of encoded signal and

chipping sequence• Imagine people talking in different languages!

© Winston Seah 8NWEN302 Computer Network Design

Page 9: Medium Access Control NWEN302 Computer Network Design

Random Access Protocols• When a node has a frame to send,

– it transmits at the full channel data rate R– no a priori coordination among nodes

• When two or more nodes transmit frames simultaneously

interference

collision!

NWEN302 Computer Network Design

© Winston Seah 9

Page 10: Medium Access Control NWEN302 Computer Network Design

Random Access Protocols• A Random Access MAC protocol specifies:

– how to detect collisions– how to recover from collisions (e.g., via delayed

retransmissions)

• Examples of random access MAC protocols:– ALOHA (developed at Univ of Hawaii in 1970s)– Slotted ALOHA– Carrier Sense Multiple Access (CSMA)– CSMA with Collision Detection (CSMA/CD)– CSMA with Collision Avoidance (CSMA/CA)

NWEN302 Computer Network Design

© Winston Seah 10

Page 11: Medium Access Control NWEN302 Computer Network Design

ALOHA Network

© Winston Seah NWEN302 Computer Network Design

11

• Connect central time-sharing

computer (on main Oahu campus)

with terminals elsewhere• 2-channel star configuration

–Users-to-computer; computer-to-users

• Random access communication for user transmissions; why random access? computer and user data are bursty…

Page 12: Medium Access Control NWEN302 Computer Network Design

ALOHA Protocol• Basic idea is simple let users transmit

whenever they have data to be sent.• If two or more users send their frames at the

same time, a collision occurs.• If there is a collision,

– sender waits a random amount of time and sends it again.

• Waiting time must be random; otherwise, the same frames will collide again.

© Winston Seah NWEN302 Computer Network Design

12

Page 13: Medium Access Control NWEN302 Computer Network Design

A Sketch of Frame Generation

Note that all frames have the same length because the throughput of ALOHA systems is maximized by having a uniform frame size.

© Winston Seah 13NWEN302 Computer Network Design

Page 14: Medium Access Control NWEN302 Computer Network Design

Throughput• Throughput:

– Number of frames successfully transmitted through the channel per frame time.

• Throughput of an ALOHA network can be determined through a simple performance analysis

© Winston Seah 14NWEN302 Computer Network Design

Page 15: Medium Access Control NWEN302 Computer Network Design

Assumptions• Infinite population of users

• New frames are generated according to a Poisson distribution with mean S frames per frame transmission time. – Probability that k frames are generated

during a given frame transmission duration:

http://homepage.stat.uiowa.edu/~mbognar/applets/pois.html!

]Pr[k

eSk

Sk

© Winston Seah 15NWEN302 Computer Network Design

frame

S new frames arriving

time

Page 16: Medium Access Control NWEN302 Computer Network Design

Observation on S• If S > 1, frames are generated at a higher

rate than the channel can handle.

• Therefore, we expect:

0 < S < 1

• If the channel can handle all the frames, then S is the throughput.

© Winston Seah NWEN302 Computer Network Design

16

Page 17: Medium Access Control NWEN302 Computer Network Design

Packet Retransmission• In addition to the new frames, the stations

also generate retransmissions of frames that previously collided.

• Assume that distribution of frames (new + retransmitted) generated is also Poisson with mean G per frame time.

© Winston Seah NWEN302 Computer Network Design

17

!]Pr[

k

eGk

Gk

Page 18: Medium Access Control NWEN302 Computer Network Design

Relation between G and S• Clearly, G ≥ S

• At low load, few collisions: G S

• At high load, many collisions: G > S

• Under all loads,

S = GP0

where P0 is the probability that a frame does not suffer a collision.

© Winston Seah 18NWEN302 Computer Network Design

Page 19: Medium Access Control NWEN302 Computer Network Design

Vulnerable Period• Under what conditions will the shaded frame

arrive undamaged?

© Winston Seah NWEN302 Computer Network Design

19

Page 20: Medium Access Control NWEN302 Computer Network Design

Throughput

• Vulnerable period: from t0 to t0+2t

• Probability that no other frame is generated during the vulnerable period is:

P0 = e-2G

• Using S = GP0, we get

S = Ge-2G

© Winston Seah 20NWEN302 Computer Network Design

Page 21: Medium Access Control NWEN302 Computer Network Design

Slotted ALOHAAssumptions:• all frames are of the same size• time divided into equal size slots (time to

transmit 1 frame)• nodes start to transmit only at beginning of a

slot• nodes are synchronized• if two or more nodes transmit in slot, all

nodes will detect the collision

© Winston Seah NWEN302 Computer Network Design

21

Page 22: Medium Access Control NWEN302 Computer Network Design

Slotted ALOHAOperation:• when a node obtains a new frame, it

transmits it in next slot– if no collision: node can send a new frame in

next slot– if collision: node retransmits the frame in

each subsequent slot with probability p until it is successful

© Winston Seah NWEN302 Computer Network Design

22

Page 23: Medium Access Control NWEN302 Computer Network Design

Slotted ALOHA

Pros• single active node can

continuously transmit at full rate of channel

• highly decentralized: only slots in nodes need to be in sync

• simple

Cons• collisions, wasting slots• idle slots• nodes may be able to

detect collision in less than time to transmit packet

• clock synchronization

NWEN302 Computer Network Design

© Winston Seah 23

Page 24: Medium Access Control NWEN302 Computer Network Design

Slotted Aloha Throughput• Assume there are N nodes with many frames to

send, and each transmits in a slot with probability, p• Probability that a given node is successful in

transmitting a frame in a slot p(1-p)N-1

• Probability that any node is successful in transmitting a frame in a slot

Np(1-p)N-1

© Winston Seah NWEN302 Computer Network Design

24

Page 25: Medium Access Control NWEN302 Computer Network Design

Slotted Aloha Throughput• Maximum throughput:

find p* that maximizes Np(1-p)N-1

• For an arbitrary number of nodes, take limit of Np*(1-p*)N-1 as N infinity, we get:

Max efficiency = 1/e = .37• Channel used for useful transmissions only

37% of time!

© Winston Seah NWEN302 Computer Network Design

25

Page 26: Medium Access Control NWEN302 Computer Network Design

Slotted ALOHA Throughput

Vulnerable period: from t0+t to t0+2t• Since transmission time is divided into

discrete intervals, only the slot in which a frame is being transmitted is vulnerable.

• Probability that no other frame is generated during the vulnerable period is:

P0 = e-G • Hence, S = Ge-G

© Winston Seah 26NWEN302 Computer Network Design

Page 27: Medium Access Control NWEN302 Computer Network Design

Relation between G and S

Aloha: Max throughput occurs at G=0.5, with S=1/(2e)=0.184.

Slotted Aloha: Max throughput occurs at G=1.0, with S=1/e=0.37.

© Winston Seah 27NWEN302 Computer Network Design

Page 28: Medium Access Control NWEN302 Computer Network Design

Carrier Sense Multiple Access• Start: listen/sense the channel

• If idle: – transmit entire frame, and wait for

acknowledgement (ACK) if no ACK received after specified duration, assume there was a collision.

• If busy:– defer transmission don’t transmit!

• Vulnerable period: one tprop

© Winston Seah NWEN302 Computer Network Design

28

Page 29: Medium Access Control NWEN302 Computer Network Design

CSMA – 1-Persistent• Start:

– sense channel

• if busy,– go back to Start:

• if idle, – send immediately– if collision is detected (i.e. no ACK)

• wait a random amount of time• go back to Start:

29© Winston Seah NWEN302 Computer Network Design

Page 30: Medium Access Control NWEN302 Computer Network Design

CSMA Non-Persistent• Start:

– sense channel• if busy,

– wait a random amount of time – go back to Start:

• if idle, – send immediately (if collision detected, same

as 1-persistent mode)• Not retrying immediately less collisions• Drawback: more delay

30© Winston Seah NWEN302 Computer Network Design

Page 31: Medium Access Control NWEN302 Computer Network Design

CSMA p-Persistent• Start:

– sense channel• if busy,

– go back to Start:• if idle,

– with probability p, transmit packet– with probability 1-p, wait tprop; go to Start:– if collision detected, same as 1-persistent

• Reduced idle channel time (1-persistent) & Reduced collisions (non-persistent)

31© Winston Seah NWEN302 Computer Network Design

Page 32: Medium Access Control NWEN302 Computer Network Design

CSMA collisions

NWEN302 Computer Network Design

Collisions can still occur:•propagation delay means two nodes may not hear each other’s transmission

•entire packet transmission time wasted

Vulnerable period: tprop

•tprop : maximum one-way propagation delay between any two nodes

•distance & propagation delay crucial in determining collision probability

spatial layout of nodes

© Winston Seah 32

Page 33: Medium Access Control NWEN302 Computer Network Design

CSMA/CD (Collision Detection)• 1-persistent approach• Continue channel sensing as

frame is being transmitted• If collision detected,

– stop frame transmission immediately;

– transmit a brief jamming signal

• Wait for a random time, and restart sequence.

© Winston Seah NWEN302 Computer Network Design

33

Page 34: Medium Access Control NWEN302 Computer Network Design

Collision Detection• Easy in wired LANs:

– measure signal strengths, compare transmitted, received signals

– CSMA/CD is used in Ethernet – the dominant wired LAN technology

• Difficult in wireless LANs: – received signal strength overwhelmed by local

transmission strength– alternative approach needed avoidance– more later…

© Winston Seah NWEN302 Computer Network Design

34

Page 35: Medium Access Control NWEN302 Computer Network Design

CSMA/CD efficiency• tprop = maximum propagation delay between 2 nodes

• ttrans = time to transmit maximum-size frame

• Efficiency/throughput goes to 1 – as tprop goes to 0

– as ttrans goes to infinity

• better performance than ALOHA, and simple, cheap,

decentralized!

© Winston Seah NWEN302 Computer Network Design

35

transprop /ttefficiency

51

1

Page 36: Medium Access Control NWEN302 Computer Network Design

Channel Utilization

Comparison of the channel utilization versus load for various random access protocols.

Page 37: Medium Access Control NWEN302 Computer Network Design

Summary of MAC protocols• channel partitioning

– TDMA, FDMA and CDMA

• random access (dynamic), – ALOHA– Slotted ALOHA– CSMA– CSMA/CD used in Ethernet / 802.3

CD (collision detection) easy in some technologies (wire)hard in others (wireless)

– CSMA/CA used in 802.11

• taking turns– polling from central site, token passing– Bluetooth, FDDI, IBM Token Ring

© Winston Seah NWEN302 Computer Network Design

37