15-441 Communications and Networking Lecture 6 Gregory Kesden.

31
15-441 15-441 Communications and Networking Communications and Networking Lecture 6 Lecture 6 Gregory Kesden Gregory Kesden
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    216
  • download

    1

Transcript of 15-441 Communications and Networking Lecture 6 Gregory Kesden.

15-44115-441Communications and NetworkingCommunications and Networking

Lecture 6Lecture 6Gregory KesdenGregory Kesden

Medium Access Control (MAC) Medium Access Control (MAC) LayerLayer

Medium Access ControlMedium Access Control

Allow multiple stations to share a common Allow multiple stations to share a common communication channelcommunication channel

Approaches:Approaches:– Take turns: token-passing, coordinator-pollingTake turns: token-passing, coordinator-polling– Spread spectrumSpread spectrum– Collision-safeCollision-safe

Master-Slave PollingMaster-Slave Polling

Master

Slave Slave Slave

•Master relays for slaves; slaves can’t talk directly•Okay when peer-to-peer is less common that client-server

•Master is single point of failure•Can pass more quickly by slaves with no data, while still limiting time for those with backlog

Token PassingToken Passing

Provide equal time slices to each station Provide equal time slices to each station – No starvation, predictable, possibly wasted slotsNo starvation, predictable, possibly wasted slots– Can be enforced by hardwareCan be enforced by hardware

Allows flexible time slices:Allows flexible time slices:– Possibility of starvation, more dynamicPossibility of starvation, more dynamic– Broken link requires electionBroken link requires election

Code Division Multiple Access (CDMA)Code Division Multiple Access (CDMA)

Each unit is given a unique id known as a Each unit is given a unique id known as a chip chip sequencesequence..

All chip sequences are the same lengthAll chip sequences are the same length All chip sequences have the same number of 0s as All chip sequences have the same number of 0s as

1s1s A sender sends a 1-bit by transmitting its chip A sender sends a 1-bit by transmitting its chip

sequencesequence A sender sends a 0-bit by transmitting the 1s A sender sends a 0-bit by transmitting the 1s

complement (flip each bit) of its chip sequencecomplement (flip each bit) of its chip sequence Collision can occur, but will not destroy dataCollision can occur, but will not destroy data

CDMA, CDMA, cont.cont.

Since each chip sequence must be of the same size and Since each chip sequence must be of the same size and have as many 0s as 1s, the dot-product of two chip have as many 0s as 1s, the dot-product of two chip sequences is 0, unless they are the same, in which case it sequences is 0, unless they are the same, in which case it is 1is 1

. .

When multiple stations transmit concurrently, their When multiple stations transmit concurrently, their signals add linearlysignals add linearly

To ensure that their power is the same, they transmit with To ensure that their power is the same, they transmit with the inverse power of the base stations’s signal strengththe inverse power of the base stations’s signal strength

Sender and receiver must be synchronized for the linear Sender and receiver must be synchronized for the linear combination to work. This is accomplished by training combination to work. This is accomplished by training the receiver to the sender using a known bit sequence.the receiver to the sender using a known bit sequence.

CDMA, CDMA, contcont

S T =

i=1

m

SiTi = 01

m

S S =

i=1

SiSi =1

mi=1

Si2

=1m

m m

i=1

(+/-1)2 = 1

1m

m

If we represent 0s and 1s as –1s and 1s, the dot product of a chip sequence and itself is 1, whereas the dot product of a chip sequence And any other chip sequence is 0.

CDMA, cont.CDMA, cont.

Recall that collision will result in the linear Recall that collision will result in the linear combination of chip sequences.combination of chip sequences.

The dot product of this linear combination of chip The dot product of this linear combination of chip sequences and the sender’s chip sequence will sequences and the sender’s chip sequence will result in a 1 if the sender sent a 1 or a –1, otherwise. result in a 1 if the sender sent a 1 or a –1, otherwise.

The other sequences “balance out” and become 0. The other sequences “balance out” and become 0. The interesting chip sequence is multiplied by The interesting chip sequence is multiplied by itself, or the compliment of itself, yielding 1 or –1. itself, or the compliment of itself, yielding 1 or –1.

Consider 0101 vs 1010 vs 1100 vs 0011 vi 0110 vs Consider 0101 vs 1010 vs 1100 vs 0011 vi 0110 vs 1001. 1001.

Pure AlohaPure Aloha

Circa 1970Circa 1970

Originally developed at Univ. of Hawaii Originally developed at Univ. of Hawaii for use across multiple campus on for use across multiple campus on multiple islandsmultiple islands

Avoided costly phone linesAvoided costly phone lines

Illustrates the principles of a Illustrates the principles of a contention-contention-based based MAC protocol on any broadcast MAC protocol on any broadcast media.media.

Pure Aloha, IllustrationPure Aloha, Illustration

Coordinator

StationStationStationStation

•Uplink is broadcast: Any station can transmit at any time(Downlink was time-sliced)•If ACK isn’t received within RTT, assume lost

•Transmission problem/interference•Collision – detected by waiting for ACK, any overlap destroys transmission

•Retransmit after random time•Wastes network time•Can be lost, themselves…repeat

Pure Aloha, Collision ExamplePure Aloha, Collision Example

A

B

C

D

E

t

window of vulnerability (2*t)

Slotted AlohaSlotted Aloha

Coordinator signals slot boundariesCoordinator signals slot boundaries– Tolerance needs to be built in for timing Tolerance needs to be built in for timing

signal’s transmission latencysignal’s transmission latency Send only at beginning of slot.Send only at beginning of slot. This reduces the window of vulnerability to a This reduces the window of vulnerability to a

single frame’s transmission time (1 slot)single frame’s transmission time (1 slot) Of course, if contention is low and collision is not Of course, if contention is low and collision is not

likely, it will increase average transmission likely, it will increase average transmission latency.latency.

Slotted Aloha, CollisionSlotted Aloha, Collision

A

B

C

D

E

tic tic tic tic tic tic tic tic tic tic tic tic tic

t

window of vulnerability (t)

Potentially unnecessary delayt

Real Islands, Real problemsReal Islands, Real problems

Stations can’t hear each other. They can’t listen for Stations can’t hear each other. They can’t listen for garbled transmissions garbled transmissions

&*%! mountains

Coordinator:King of the mountain

Carrier Sense Multiple Access Carrier Sense Multiple Access (CSMA)(CSMA)

But, what all stations can listen?But, what all stations can listen?

……if, instead of using slots, stations just “listen” if, instead of using slots, stations just “listen” first, and only transmit if no one else is?first, and only transmit if no one else is?

This means that collisions would only occur in the This means that collisions would only occur in the event of a “tie” – two stations listened and then event of a “tie” – two stations listened and then transmitted?transmitted?

This leads to much better performance – the This leads to much better performance – the window of vulnerability is very small – just the window of vulnerability is very small – just the transmission latency.transmission latency.

Persistent CSMAPersistent CSMA

Under Under persistent CSMApersistent CSMA stations continually stations continually sense the channel and transmit as soon as it sense the channel and transmit as soon as it is free.is free.

The problem is that a queue could have The problem is that a queue could have been building up during the prior been building up during the prior transmission.transmission.

This ensures almost certain collision to This ensures almost certain collision to follow. follow.

Nonpersistent CSMANonpersistent CSMA

Nonpersistent CSMA Nonpersistent CSMA will transmit immediately if will transmit immediately if the channel is free. The recent past is a good the channel is free. The recent past is a good indicator of the near future. A collision isn’t likely. indicator of the near future. A collision isn’t likely.

If however, a station listens and hears a If however, a station listens and hears a transmission, it stops listening and waits a random transmission, it stops listening and waits a random amount of time before trying again. amount of time before trying again.

This helps to mitigate the queuing of requests This helps to mitigate the queuing of requests during a transmission from leading to a collision during a transmission from leading to a collision

p-Persistent CSMAp-Persistent CSMA

pp is a parameter. It specifies the probability with which a is a parameter. It specifies the probability with which a station should transmit upon detecting an idle channel. station should transmit upon detecting an idle channel.

In other words, if the channel is free, a station begins to In other words, if the channel is free, a station begins to transmit immediately with a probability of transmit immediately with a probability of p.p.

The other (1-p) time, the station waits a random amount of The other (1-p) time, the station waits a random amount of time. After this random delay, it rolls the dice again – and time. After this random delay, it rolls the dice again – and transmits or waits, accordingly. transmits or waits, accordingly.

This system is designed to further reduce the likelihood of This system is designed to further reduce the likelihood of collision by spreading out bursts. collision by spreading out bursts.

Quiet &*@* it!Quiet &*@* it!

Why do stations keep transmitting during a Why do stations keep transmitting during a collision?collision?

Consider Aloha – used radiosConsider Aloha – used radios– Most can’t concurrently transmit and receive (to Most can’t concurrently transmit and receive (to

protect receiver), so they can’t hear the garblingprotect receiver), so they can’t hear the garbling

Even if they could listen while transmitting, they’d Even if they could listen while transmitting, they’d likely only hear selflikely only hear self– Signal weakens with inverse-square, so they out-Signal weakens with inverse-square, so they out-

power other senderpower other sender These assumptions change if medium isn’t radio, These assumptions change if medium isn’t radio,

but instead copper wire. but instead copper wire.

CSMA/CDCSMA/CD

Another level of sophistication is the addition of Another level of sophistication is the addition of collision detectioncollision detection. . – EthernetEthernet

Stations listen while transmittingStations listen while transmitting If a station hears something different than what it If a station hears something different than what it

is sending, it immediate stopsis sending, it immediate stops What it hears is different from what it sends, if What it hears is different from what it sends, if

another transmission garbles the original.another transmission garbles the original.

IEEE 802.3 (including Ethernet) protocols are 1-IEEE 802.3 (including Ethernet) protocols are 1-persistent CSMA/CD. persistent CSMA/CD.

CSMA/CD: Jamming SignalCSMA/CD: Jamming Signal

What if two colliding signals, propagating in What if two colliding signals, propagating in opposite directions, cancel each other out? opposite directions, cancel each other out?

If any station detects a collision, it sends a If any station detects a collision, it sends a jamming signaljamming signal to make sure that the colliding to make sure that the colliding signals don’t cancel each other out, preventing signals don’t cancel each other out, preventing detection after attenuation. detection after attenuation.

This reduces the time wasted in the event of a This reduces the time wasted in the event of a collision sending already garbled packets.collision sending already garbled packets.

CSMA/CD: Min. Frame SizeCSMA/CD: Min. Frame Size Because of latency, collisions cannot be detected immediately. Because of latency, collisions cannot be detected immediately.

This signal from one transmitter much reach the other transmitter. This signal from one transmitter much reach the other transmitter.

In practice, this imposes a minimum size on the length of a In practice, this imposes a minimum size on the length of a frame. The frame must be long enough to permit a collision to be frame. The frame must be long enough to permit a collision to be detected. detected.

If the frame is too short, it will be gone before the signal from If the frame is too short, it will be gone before the signal from one transmitter reaches another. one transmitter reaches another.

The frames will be corrupted as the “cross in the mail”The frames will be corrupted as the “cross in the mail”

But neither sender will be able to detect it, until the whole frame But neither sender will be able to detect it, until the whole frame has been sent, which defeats the purpose. has been sent, which defeats the purpose.

Minimum Frame Size for Minimum Frame Size for CSMA/CDCSMA/CD

The frame needs to be sufficiently long to require more than a round-The frame needs to be sufficiently long to require more than a round-trip time for transmission. trip time for transmission.

We must consider the bit-rate of the channel as well as its length to We must consider the bit-rate of the channel as well as its length to determine the round trip time. determine the round trip time.

The frame must require more than this round-trip time for The frame must require more than this round-trip time for transmission or the sender won’t necessarily still be transmitting when transmission or the sender won’t necessarily still be transmitting when the conflicting signal is first heard.the conflicting signal is first heard.

•B bits/second•S seconds•B*S bit time

B*S

Sender1 Sender2Sender2 detects the Collision almost immediately

Sender 1 must wait for its frame to (almost) make it to Sender2, when the collision occurs, and then for the energyfrom Sender2’s frame to make it back, before detecting the collision.

CSMA/CD: ObservationsCSMA/CD: Observations Frame size is a function ofFrame size is a function of

– Wire sizeWire size– Transmission speedTransmission speed

So…So…– Faster speeds or longer wires imply larger framesFaster speeds or longer wires imply larger frames– Smaller frames require slower speeds or shorter wiresSmaller frames require slower speeds or shorter wires

Consider the “bandwidth-delay product”Consider the “bandwidth-delay product”– Minimum frame size = Minimum frame size =

(2*length)/propagation_speed*bit_rate(2*length)/propagation_speed*bit_rate

Think of it this way:Think of it this way:– How much time does it take a single to make a round trip? How much time does it take a single to make a round trip?

» (2*length) X propagation speed (distance/s)(2*length) X propagation speed (distance/s)– How fast are bits being placed on the wire?How fast are bits being placed on the wire?

» bit-rate (b/s)bit-rate (b/s)– How many bits are placed on the wire during this round trip?How many bits are placed on the wire during this round trip?

(2*length)/propagation_speed*bit_rate(2*length)/propagation_speed*bit_rate

Can we use Carrier Detection Over a Can we use Carrier Detection Over a Satellite?Satellite?

Nope. Why not?Nope. Why not? Stations transmit up to a satellite, which then echo everything Stations transmit up to a satellite, which then echo everything

back down.back down. Stations can’t sense each others transmissions, until they are Stations can’t sense each others transmissions, until they are

echoed back down – the transmitters are too far apart and echoed back down – the transmitters are too far apart and focused on the satellite. focused on the satellite.

The propagation delay between the transmission to the The propagation delay between the transmission to the satellite and the echo back down is about 270mssatellite and the echo back down is about 270ms

Throughput might be on the order of 36MbpsThroughput might be on the order of 36Mbps Consider the size of the frame needed to detect collision. Consider the size of the frame needed to detect collision.

What Mountains: Back to WirelessWhat Mountains: Back to Wireless

Consider shorter-range wireless: No MountainsConsider shorter-range wireless: No Mountains But, still challenges: Reachability is not transitive:But, still challenges: Reachability is not transitive:

– A can reach BA can reach B

– B can Reach CB can Reach C

– A cannot reach CA cannot reach C

A B C D

What Mountains: Back to WirelessWhat Mountains: Back to Wireless

A and C can’t hear each otherA and C can’t hear each other– Can’t detect that they are colliding at BCan’t detect that they are colliding at B– A and C are A and C are hiddenhidden from each other from each other

B can hear and C, but C and A can’t hear each otherB can hear and C, but C and A can’t hear each other– C hears B transmit to A, so B waits before transmitting to DC hears B transmit to A, so B waits before transmitting to D

» This is unnecessary, because D can’t hear BThis is unnecessary, because D can’t hear B– B and D are both exposed to CB and D are both exposed to C

A B C D

MACA: Multiple Access with MACA: Multiple Access with Collision AvoidanceCollision Avoidance

Don’t assume we know what the receiver can hear. Instead, ask the Don’t assume we know what the receiver can hear. Instead, ask the receiverreceiver– Request to send (RTS) w/data size (number of frames)Request to send (RTS) w/data size (number of frames)– If RTS not ACKed, assume collisionIf RTS not ACKed, assume collision– Data should also be ACKed (to let other senders know they can Data should also be ACKed (to let other senders know they can

RTS)RTS)

MACA: ExampleMACA: Example

White: RTS from B to C (heard also by A)White: RTS from B to C (heard also by A) White-Dashed: RTS-ACK from C to B (heard also by D)White-Dashed: RTS-ACK from C to B (heard also by D) Black: Data from B to C (heard also by A)Black: Data from B to C (heard also by A) Black-Dashed: Data-ACK from C to B (heard also by D)Black-Dashed: Data-ACK from C to B (heard also by D)

A B C D

MACA Example: Another ViewMACA Example: Another View

A B C D

Not intended recipient

Not intended recipient