• No results found

CSE 123A Computer Networks

N/A
N/A
Protected

Academic year: 2021

Share "CSE 123A Computer Networks"

Copied!
40
0
0

Loading.... (view fulltext now)

Full text

(1)

CSE 123A CSE 123A

Computer Networks Computer Networks

Winter 2005 Winter 2005

Lecture 5:

Lecture 5:

Data Data - - Link II: Media Access Link II: Media Access

(2)

Last Time Last Time

z

Framing: How to translate a bitstream into separate packets

…101010111001001111000010110

000010110 001001111 101010111

(3)

Today: media access Today: media access

z

How to share a channel among different hosts?

z

Approaches

Channel partitioning

»

FDMA, TDMA, CDMA

Random access

»

Contention-based

„ Aloha

„ CSMA, CSMA/CD, CSMA/CA

„ Ethernet, 802.11

»

Contention-free

„ Token-ring, FDDI

(4)

Channel partitioning Channel partitioning

z

Problem

Have channel that can support 10Mbps

Have 5 hosts, who want to send 2Mbps of data

How to meet this need and use channel efficiently

z

Solution

Create 5 channels each 1/5

th

the size

Next question: how to split the channel

(5)

Frequency Division Frequency Division

Multiple Access (FDMA) Multiple Access (FDMA)

z

Divide channel with some bandwidth f Hz into n subchannels each with bandwidth f/n Hz

z

Assign different hosts to different channels

z

Easy to implement, but unused subchannels go idle

z

Used by traditional analog cell phone service

AmplitudeAmplitude

Frequency

(6)

Time Division Multiple Access Time Division Multiple Access

(TDMA) (TDMA)

z

Divide channel into time rounds of length t with n time slots in each round

z

Assign different hosts to different time slots within a round

z

Unused time slots are idle

z

Used (in conjunction with FDM) in GSM cell phones

z

Example, rounds of 1 second, with 4 timeslots (250ms) per round

1 2 3 1 2 3 4 2 4

Host #

(7)

Code Division Multiple Access Code Division Multiple Access

z

Very different, spread spectrum coding

All hosts use the whole channel all the time (?!?)

z

Assign different hosts a unique spreading

code which encodes transmitted data to cover the entire channel

z

Receivers apply same code to extract the source signal they want out of the channel

z

Used by cell phone networks using Qualcomm chipsets (e.g. Verizon, Sprint)

z

Magic

(8)

Channel partitioning summary Channel partitioning summary

FDMA

TDMA

CDMA time

time

power power power

cy frequency

frequency

(9)

Problem Problem

z

Not terribly well suited for random access usage. Why?

z

New problem: how to do we share a single

channel among different hosts who want to

send different amounts of data at different

times?

(10)

Aloha Aloha

z

Designed in 1970 to explore wireless data connectivity between Hawaiian Islands

z

Goal: distributed access control (no central arbitrator) over a shared broadcast channel

z

Aloha protocol in a nutshell:

When you have data send it

If data doesn’t get through (receiver sends

acknowledgement) then retransmit after a random

delay

(11)

Problem Problem

z

Any packet sent at t

0

collide with other pkts

sent in [t

0

-1, t

0

+1]

(12)

Slotted Aloha Slotted Aloha

Success (S), Collision (C), Empty (E) slots

z

Time is divided into equal size slots (= pkt trans. time)

z

Host wanting to transmit starts at start of next slot

z

But requires time synchronization between hosts

(13)

Slotted Aloha Efficiency Slotted Aloha Efficiency

Q: What is max fraction slots successful?

A: Suppose N stations have packets to send

Each transmits in slot with probability p

Prob. successful transmission S is:

single node: S = p (1-p)(N-1) any of N nodes:

S = Prob (only one transmits) S = N p (1-p)(N-1)

(optimal p as N->infinity = 1/N)

= 1/e = .37

At best: channel used for useful transmissions 37%

of time!

offered load = N X p

0.5 1.0 1.5 2.0 0.1

0.2 0.3 0.4

Pure Aloha

Slotted Aloha

(14)

Carrier Sense Multiple Access Carrier Sense Multiple Access

(CSMA) (CSMA)

z

Aloha transmits even if another host is transmitting (guaranteed collision)

z

Can do better by listening first to make sure channel is idle

z

Effective if # of pkts on the channel is small (bw*delay/packet size)

Small (<<1) for LANs, large (>>1) for satellites

(15)

How long to wait if channel is How long to wait if channel is

busy?

busy?

z

1-persistent CSMA

Send as soon as channel is idle

Problem: blocked senders all try to send at once

z

non-persistent CSMA

Send after some random delay

Problem: may incur larger delay when channel is idle

z

p-persistent CSMA

If idle, send packet with probability p; repeat

Make sure p * number of hosts < 1

(16)

CSMA with Collision Detection CSMA with Collision Detection

(CSMA/CD) (CSMA/CD)

z

Even with CSMA there can still be collisions. Why?

z

For wired media we can detect all collisions and abort (CSMA/CD):

Requires a minimum frame size (“acquiring the medium”)

B must continue sending (“jam”) until A detects collision

Tough for radio (hard to listen & xmit at same time)

collision X (wire)

A B

Time for B to detect A’s transmission

(17)

Ethernet Ethernet

z

First local area network (building in early ’70s by Metcalfe and Boggs)

z

Originally 1Mbps, now supports 10Mbps, 100Mbps, 1Gbps and 10Gbps flavots

z

Currently the dominant LAN technology

(18)

Classic Ethernet Classic Ethernet

z

IEEE 802.3 standard wired LAN (modified 1-persistent CSMA/CD)

z

Classic Ethernet: 10 Mbps over coaxial cable

All nodes share same wire

Max length 2.5km, max between stations 500m

z

Framing

Preamble, 32bit CRC, variable length data,

min frame 64 bytes (why?), max 1500 bytes (why?)

Unique 48-bit address per host (bcast & multicast addrs too)

nodes

(wire)

(19)

Ethernet improvements Ethernet improvements

z

Jamming

Send special 48 bit sequence to ensure collision detection by all hosts

z

Exponential backoff

Problems with random delay with fixed mean

»

Few senders = unnecessary delay

»

Many senders = unnecessary collisions

Ethernet approach: balance delay w/load

»

First collision: wait 0 or 1 min frame times at random, retry

»

Second time: wait 0, 1, 2, or 3 times

»

Nth time (N<=10): wait 0, 1, …, 2

N

-1 times

(20)

Capture Effect Capture Effect

z

Randomized access scheme is not fair

z

Stations A and B always have data to send

They will collide at some time

Suppose A wins and sends, while B backs off

Next time they collide and B’s chances of winning

are halved!

(21)

Ethernet Performance Ethernet Performance

z

Much better than Aloha or CSMA in practice

z

Source of protocol inefficiency: collisions

More efficient to send larger frames

»

Acquire the medium and send lots of data

Less efficient if

»

More hosts – more collisions needed to identify single sender

»

Smaller packet sizes – more frequent arbitration

»

Longer links – collisions take longer to observe, more

wasted bandwidth

(22)

Contention

Contention - - free Protocols free Protocols

z

Problem with channel partitioning

Inefficient at low load (idle subchannels)

z

Problem with contention-based protocols

Inefficient at high load (collisions)

z

Contention-free protocols

Try to do both by explicitly taking turns

Can potentially also offer guaranteed bandwidth,

latency, etc.

(23)

Two contention

Two contention - - free free approaches

approaches

Polling

z Master node “invites” slave nodes to transmit in turn

z Request to Send (RTS), Clear to Send (CTS) messages

z Problems:

Polling overhead

Latency

Single point of failure (master)

Token Passing

z Control token passed from one node to next sequentially.

z Point-to-point links can be fast

z Problems:

Token overhead

Latency

Single point of failure (token)

(24)

Token Ring (802.5) Token Ring (802.5)

z

Token rotates permission to send around node

z

Sender injects packet into ring and removes later

Maximum token holding time (THT) bounds access time

Early or delayed token release

Round robin service, acknowledgments and priorities

A C B

D nodes

Direction of

transmission

(25)

FDDI

FDDI (Fiber Distributed Data (Fiber Distributed Data Interface)

Interface)

z

Roughly a large, fast token ring

100 Mbps and 200km vs 4/16 Mbps and local

Dual counter-rotating rings for redundancy

Complex token holding policies for voice etc. traffic

z

Token ring advantages

No contention, bounded access delay

Support fair, reserved, priority access

z

Disadvantages

Complexity, reliability, scalability

Break!

(26)

Why Did Ethernet Win?

Why Did Ethernet Win?

z

Failure modes

Token rings – network unusable

Ethernet – node detached

z

Good performance in common case

z

Volume Æ lower cost Æ higher volume ….

z

Adaptable

To higher bandwidths (vs. FDDI)

To switching (vs. ATM)

z

Completely distributed, easy to maintain/administer

z

Easy incremental deployment

z

Cheap cabling, etc

(27)

Wireless Media Access Wireless Media Access

Wireless is more complicated than wired …

z

Cannot detect collisions

Transmitter swamps co-located receiver

Collision avoidance

z

Different transmitters have different coverage areas

Asymmetries lead to hidden/exposed terminal problems

Also use contention-free protocols (RTS/CTS)

(28)

z

A and C can both send to B but can’t hear each other

A is a hidden terminal for C and vice versa

CSMA will be ineffective – want to sense at receiver

Hidden Terminals Hidden Terminals

A B C

transmit range

(29)

Exposed Terminals Exposed Terminals

z

B, C can hear each other but can safely send to A, D

A B C

transmit range

D

(30)

CSMA with Collision CSMA with Collision

Avoidance (CSMA/CA) Avoidance (CSMA/CA)

z

Since we can’t detect collisions, we try to avoid them

z

When medium busy, choose random interval (contention window)

Wait for that many idle timeslots to pass before sending (

Remember p-persistence … a refinement

z

When a collision is inferred, retransmit with binary exponential backoff (like Ethernet)

Use ACK from receiver to infer “no collision”

Again, exponential backoff helps us adapt “p” as needed

(31)

Overcome exposed/hidden terminal problems with contention-free protocol

1.

B stimulates C with Request To Send (RTS)

2.

A hears RTS and defers to allow the CTS

3.

C replies to B with Clear To Send (CTS)

4.

D hears CTS and defers to allow the data

5.

B sends to C

RTS / CTS Protocols (MACA) RTS / CTS Protocols (MACA)

B RTS C D

A CTS

(32)

IEEE 802.11 Wireless LAN IEEE 802.11 Wireless LAN

z

802.11b

2.4-5 GHz unlicensed radio spectrum

up to 11 Mbps

direct sequence spread spectrum (DSSS) in physical layer

» All hosts use same code

Widely deployed, using base stations

z 802.11a

5-6 GHz range

up to 54 Mbps

z 802.11g

2.4-5 GHz range

up to 54 Mbps

z

All use CSMA/CA for multiple access

z

Optional RTS/CTS

z

All have base-station and

ad-hoc network versions

(33)

IEEE 802.11 Wireless LAN IEEE 802.11 Wireless LAN

z

Wireless host communicates with a base station

Base station = access point (AP)

z Basic Service Set (BSS) (a.k.a. “cell”) contains:

Wireless hosts

Access point (AP): base station

z BSS’s combined to form distribution system (DS)

(34)

z

Ad hoc network: IEEE 802.11 stations can dynamically form network without AP

z

Theoretical Applications:

Laptops meeting in conference room, car

Interconnection of “personal” devices

Rare in practice

Ad Hoc Networks

Ad Hoc Networks

(35)

802.11 Twists 802.11 Twists

z

How to support different speeds on same channel?

Physical layer header encoded at lowest bitrate and indicates bitrate of rest of packet

z

Network Allocation Vector (NAV)

Each frame contains field that indicates the amount of time that will be used for the communication (channel reservation)

All receivers defer xmit for that time

Allows for long or multi-frame exchange

z

RTS/CTS used as function of packet size

Why?

(36)

Misc Misc issues issues

z

Addressing

(37)

Misc Misc issue: issue:

Addressing Alternatives Addressing Alternatives

z

On a broadcast channel all nodes receive all packets

Addressing determines which packets are kept and which are packets are thrown away

Packets can be sent to:

» Unicast – one destination

» Multicast – group of nodes (e.g. “everyone playing Quake”)

» Broadcast – everybody on wire

z

Dynamic addresses (e.g. Appletalk)

Pick an address at random

Broadcast “is anyone using address XX?”

If yes, repeat

z

Static address (e.g. Ethernet, 802.11, TokenRing, etc)

(38)

IEEE addressing (

IEEE addressing ( Ethernet,etc Ethernet,etc ) )

z

Addresses: 6 bytes (48bits)

Each adapter is given a globally unique address at manufacturing time ($$$)

» Address space is allocated to manufacturers

„ 24 bits identify manufacturer

„ E.g., 0:0:15:* Æ 3com adapter

» Frame is received by all adapters on a LAN and dropped if address does not match

Special addresses

» Broadcast – FF:FF:FF:FF:FF:FF is “everybody”

» Range of addresses allocated to multicast

„ Adapter maintains list of multicast groups node is interested in

(39)

Summary Summary

z

Ways to share a channel

Subdivide the channel into subchannels

Contention-based protocols

» Try and retry if it fails

Contention-free protocols

» Explicit control over who gets to send at each time

z

Particular issues for wireless

Hidden/exposed terminal problems

z

Addressing

z

For next time: bridging/switching, read 3.2, 3.1

z

First homework & programming assignment will be

given out

(40)

Backup: End to End Delay in Backup: End to End Delay in

Ethernet Ethernet

z

c in cable = 60% * c in vacuum = 1.8 x 10^8 m/s

z

Modern 10Mb Ethernet

2.5km, 10Mbps

~= 12.5us delay

+Introduced repeaters (max 5 segments)

Worst case – 51.2us round trip time!

z

Slot time = 51.2us = 512bits in flight

After this amount, sender is guaranteed sole access to link

51.2us = slot time for backoff

References

Related documents