lecture25: media access control · cse 123 –lecture 25: modulation courtesy robin kravets 8....

26
CSE 123: Computer Networks Aaron Schulman Lecture 2 5 : Media Access Control

Upload: others

Post on 10-Aug-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

CSE 123: Computer NetworksAaron Schulman

Lecture 25:Media Access Control

Page 2: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Overview! Finish timing (clock) recovery

u Manchester, 4B/5B, etc.

! Methods to share physical media: multiple accessu Fixed partitioningu Random access

! Channelizing mechanisms

! Contention-based mechanismsu Aloha

2CSE 123 – Lecture 25: Media Access Control

Page 3: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Why the sampling rate matters…! Signal could have multiple interpretations

3

Signal

0 0 1 1 0 0 1 1

Signal

0 1 0 1

Which of these is correct?

CSE 123 – Lecture 25: Modulation

Page 4: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Nyquist Revisited! Sampling at the correct rate (2f) yields actual signal

u Always assume lowest-frequency wave that fits samples

! Sampling too slowly yields aliases

4CSE 123 – Lecture 25: Modulation

Page 5: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

The Importance of Phase! Need to determine when to START sampling, too

5CSE 123 – Lecture 25: Modulation

Page 6: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Clock Recovery! Using a training sequence to get receiver lined up

u Send a few, known initial training bitsu Adds inefficiency: only m data bits out of n transmitted

! Need to combat clock drift as signal proceedsu Use transitions to keep clocks synched up

! Question is, how often do we do this?u Quick and dirty every time: asynchronous codingu Spend a lot of effort to get it right, but amortize over lots of

data: synchronous coding

6CSE 123 – Lecture 25: Modulation

Page 7: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Asynchronous Coding

7

! Encode several bits (e.g. 7) together with a leading “start bit” and trailing “stop bit”

! Data can be sent at any time

! Start bit transition kicks of sampling intervals! Can only run for a short while before drifting

CSE 123 – Lecture 25: Modulation

Page 8: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Example: RS232 serial lines! Uses two voltage levels (+15V, -15V), to encode

single bit binary symbols! Needs long idle time – limited transmit rate

idle start 1 110 0 0 0 stop idle-15

+

+15

Time

Volta

ge

8Courtesy Robin KravetsCSE 123 – Lecture 25: Modulation

Page 9: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Synchronous coding! Encode many bits (thousands) together

u Amortize cost of learning clock information from start bits (preamble) and stop bits (trailer)

u Continuously “learn” clock from data stream» Watch for 0-1 or 1-0 transitions, and adjust clock» Called clock recovery process

! Examplesu NRZu NRZIu Manchesteru 4B/5Bu Many others…

20CSE 123 – Lecture 25: Modulation

Page 10: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Synchronous Coding! Asynchronous receiver phase locks each symbol

u Takes time, limiting transmission rates

! So, start symbols need to be extra slowu Need to fire up the clock, which takes time

! Instead, let’s do this training once, then just keep syncu Need to continually adjust clock as signal arrivesu Ever hear of Phase Lock Loops (PLLs) ?

! Basic idea is to use transitions to lock in

10CSE 123 – Lecture 25: Media Access Control

Page 11: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Non-Return to Zero (NRZ)! Signal to Data

u High ð 1u Low ð 0

! Commentsu Transitions maintain clock synchronizationu Long strings of 0s confused with no signalu Long strings of 1s causes baseline wander

» We use average signal level to infer high vs lowu Both inhibit clock recovery

Bits 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0

NRZ

Courtesy Robin Kravets 11CSE 123 – Lecture 25: Media Access Control

Page 12: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Non-Return to Zero Inverted (NRZI)

! Signal to Datau Transition ð 1u Maintain ð 0

! Commentsu Solves series of 1s, but not 0s

Bits 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0

NRZ

NRZI

CSE 123 – Lecture 25: Modulation

Page 13: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Manchester Encoding(10Mbps Ethernet)

! Signal to Datau XOR NRZ data with senders clock signalu High to low transition ð 1u Low to high transition ð 0

! Commentsu Solves clock recovery problemu Only 50% efficient ( ½ bit per transition)u Still need preamble (typically 0101010101… trailing 11 in Ethernet)

Bits 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0

NRZ

Clock

Manchester

CSE 123 – Lecture 25: Modulation

Page 14: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

4B/5B (100Mbps Ethernet)! Goal: address inefficiency of Manchester encoding, while

avoiding long periods of low signals! Solution:

u Use five bits to encode every sequence of four bits u No 5 bit code has more than one leading 0 and two trailing 0’s u Use NRZI to encode the 5 bit codes u Efficiency is 80%

0000 111100001 010010010 101000011 101010100 010100101 010110110 011100111 01111

1000 100101001 100111010 101101011 101111100 110101101 110111110 111001111 11101

4-bit 5-bit 4-bit 5-bit

CSE 123 – Lecture 25: Modulation

Page 15: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Encoding/Decoding Summary! Signaling & Modulation

u Transforming digital signal to and from analog representationu Fundamental limits (Shannon)u Lots of ways to encode signal (modulation) onto a given

medium

! Clock recoveryu Receiver needs to adjust its sampling times to best extract

signal from channelu Sender can code signal to make it far easier to do this

15CSE 123 – Lecture 23: Media Access Control

Page 16: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Fixed Partitioning! Need to share media with multiple nodes (n)

u Multiple simultaneous conversations

! A simple solutionu Divide the channel into multiple, separate channels

! Channels are physically separateu Bitrate of the link is split across channelsu Nodes can only send/receive on their assigned channel

! Several different ways to do itu _____ Multiple Access madlibs…

16CSE 123 – Lecture 25: Media Access Control

Page 17: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

! Divide bandwidth of f Hz into n channels each with bandwidth f/n Hzu Easy to implement, but unused subchannels go idleu Used by traditional analog cell phone service, radio, TV

Ampl

itude

Frequency

Ampl

itude

Frequency

17

Frequency Division (FDMA)

CSE 123 – Lecture 25: Media Access Control

Page 18: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

! Divide channel into rounds of n time slots eachu Assign different hosts to different time slots within a roundu Unused time slots are idleu Used in GSM cell phones & digital cordless phones

! Example with 1-second roundsu n=4 timeslots (250ms each) per round

1 2 3 31 2 4 2 4

1 sec 1 sec 1 sec

Host #

18

Time Division (TDMA)

CSE 123 – Lecture 25: Media Access Control

Page 19: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

19

Code Division (CDMA)! Do nothing to physically separate the channels

u All stations transmit at same time in same frequency bandsu One of so-called spread-spectrum techniques

! Sender modulates their signal on top of unique codeu Sort of like the way Manchester modulates on top of clocku The bit rate of resulting signal much lower than entire channel

! Receiver applies code filter to extract desired senderu All other senders seem like noise with respect to signal

! Used in older digital cellular technologiesCSE 123 – Lecture 25: Media Access Control

Page 20: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Partitioning Visualization(the ranbow cake)

FDMA

TDMA

CDMA

time

time

time

power

power

power

frequency

frequency

frequency

Courtesy Takashi Inoue

20CSE 123 – Lecture 25: Media Access Control

Page 21: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Problem w/Channel partitioning

! Not terribly well suited for random access usageu Why?

! Instead, design schemes for more common situationsu Not all nodes want to send all the timeu Don’t have a fixed number of nodes

! Potentially higher throughput for transmissionsu Active nodes get full channel bandwidth

21CSE 123 – Lecture 25: Media Access Control

Page 22: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Aloha! Designed in 1970 to support wireless data connectivity

u Between Hawaiian Islands—rough!

! Goal: distributed access control (no central arbitrator)u Over a shared broadcast channel

! Aloha protocol in a nutshell:u When you have data send itu If data doesn’t get through (receiver sends acknowledgement)

then retransmit after a random delayu Why not a fixed delay?

22CSE 123 – Lecture 25: Media Access Control

Page 23: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Collisions! Frame sent at t0 collides with frames sent in [t0-1, t0+1]

u Assuming unit-length framesu Ignores propagation delay

23CSE 123 – Lecture 25: Media Access Control

Page 24: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Slotted Aloha

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

! Time is divided into equal size slots (frame size)! Host wanting to transmit starts at start of next slot

u Retransmit like w/Aloha, but quantize to nearest next slot! Requires time synchronization between hosts

24CSE 123 – Lecture 25: Media Access Control

Page 25: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

Q: What is max fraction slots successful?A: Suppose n stations have packets to send

u Each transmits in slot with probability pu Prob[successful transmission], S, is:

S = p (1-p)(n-1)

u any of n nodes:

S = Prob[one transmits] = np(1-p)(n-1)(optimal p as n->infinity = 1/n)

= 1/e = .37

At best: channelused for useful transmissions 37%of time!

offered load = n X p0.5 1.0 1.5 2.0

0.1

0.2

0.3

0.4

Pure Aloha

Slotted Aloha

Channel Efficiency

25CSE 123 – Lecture 25: Media Access Control

Page 26: Lecture25: Media Access Control · CSE 123 –Lecture 25: Modulation Courtesy Robin Kravets 8. Synchronous coding! Encode many bits (thousands) together u Amortize cost of learning

For Next Time

! Keep going on the project…

26CSE 123 – Lecture 25: Media Access Control