lecture13 - Academic Csuohio
Download
Report
Transcript lecture13 - Academic Csuohio
EEC-484/584
Computer Networks
Lecture 13
Wenbing Zhao
[email protected]
2
Outline
• Medium Access Control
• Ethernet
– Manchester Encoding
– The Ethernet MAC Sublayer Protocol
– The Binary Exponential Backoff Algorithm
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
3
Medium Access Control Sublayer
• Broadcast channels often used on data
link layer
– Broadcast channels often referred to as
multiaccess or random access channels
• The channel allocation problem: Who gets
to use the channel?
– Static Channel Allocation
– Dynamic Channel Allocation
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
4
Static Channel Allocation
• FDM – Frequency Division Multiplexing
– Frequency spectrum divided into logical channel
– Each user has exclusive use of own frequency band
• TDM – Time Division Multiplexing
– Time divided into slots each user has time slot
– Users take turns in round robin fashion
• Problem: wasted bandwidth if user does not use
his/her frequency band or timeslot
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
5
Frequency Division Multiplexing
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
6
Time Division Multiplexing
T1 Carrier (1.544 Mbps)
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
Model for
Dynamic Channel Allocation
• N independent stations (also called terminals)
• Once a frame has been generated, the station is
blocked until the frame is transmitted successfully
• Single Channel shared by all stations
• Collision – event when two frames transmitted
simultaneously and the resulting signal is garbled
– All stations can detect collisions
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
7
Model for
Dynamic Channel Allocation
• Frame transmission time
– Continuous Time – can begin at any instant
– Slotted Time – always begin at the start of a
slot
• Carrier sense or not
– Carrier sense – stations can tell if the channel
is busy. Do not send if channel is busy
– No carrier sense – just go ahead and send
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
8
9
Multiple Access Protocols
• ALOHA
• Carrier Sense Multiple Access Protocols
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
10
Pure ALOHA
• Let users transmit whenever they have data
to send
• If frame destroyed
(due to collision),
sender waits
random amount
of time, sends again
• User does not listen before transmitting
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
11
Pure ALOHA: Vulnerable Period
• Vulnerable period for a frame: A collision will
happen if another frame is sent during this period
2 frame time
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
12
Slotted ALOHA
• Idea: divide time into intervals, each
interval corresponds to one frame
– Station is permitted to send only at the
beginning of next slot
• Vulnerable period is halved (1 frame time)
– Probability of no collision in time slot = e-G
– Throughput S = G e-G
– Max occurs when G = 1, S = 2*0.184
(G: # of attempts per frame time)
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
13
Throughput for ALOHA Systems
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
14
Carrier Sense Multiple Access
• When station has data to send, listens to channel
to see if anyone else is transmitting
• If channel is idle, station transmits a frame
– Else station waits for it to become idle
• If collisions occurs, station waits random amount
of time, tries again
• Also called 1-persistent CSMA
– With probability 1 station will transmit if channel is idle
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
Carrier Sense Multiple Access:
Collision Still Possible
• After a station starts sending, it takes a while
before 2nd station receives 1st station’s signal
– 2nd station might start sending before it knows that
another station has already been transmitting
• If two stations become ready while third station
transmitting
– Both wait until transmission ends and start
transmitting, collision results
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
15
16
p-persistent CSMA:
Reduce the Probability of Collision
• Sense continuously, but does not always send
when channel is idle
– Applicable for slotted channels
• When ready to send, station senses the channel
– If channel idle, station transmits with probability p,
defers to next slot with probability q = 1-p
– Else (if channel is busy) station waits until next slot
tries again
– If next slot idle, station transmits with probability p,
defers with probability q = 1-p
– …
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
17
Non-Persistent CSMA
• Does not sense continuously, send if it senses
the channel is idle
• Before sending, station senses the channel
– If channel is idle, station begins sending
– Else station does not continuously sense, waits
random amount of time, tries again
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
18
Persistent and Nonpersistent CSMA
• Improves over ALOHA because they ensure no
station to transmit when it senses channel is busy
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
19
CSMA with Collision Detection
• If two stations start transmitting simultaneously,
both detect collision and stop transmitting
• Minimum time to detect collision?
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
20
Minimum Time to Detect Collision
• To ensure the sender can detect collision
– All frames must take more than 2t to send so that
transmission is still taking place when the noise burst
gets back to the sender
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
21
Manchester Encoding
• Binary encoding
– Hard to distinguish 0 bit (0-volt) from idle (0-volt)
– Requires clocks of all stations synchronized
• Manchester encoding and differential Manchester encoding
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
Ethernet Frame Structure
22
• Preamble: for clock synchronization
– First 7 bytes with pattern 10101010, last byte with pattern
10101011
– The two consecutive 1’s indicate the start of a frame
• How can the receiver tell the end of the frame?
– No current on the wire (interesting discussion at
http://www.tomshardware.com/forum/19951-42-detecting-length-ethernet-frame)
Not considered
as part of the
header!
4/10/2016
>= 64 bytes
EEC-484/584: Computer Networks
Wenbing Zhao
Ethernet Frame Structure
• Destination address: 6 bytes (48 bits)
– Highest order bit: 0 individual, 1 multicast;
all 1’s broadcast
– Frames received with non-matching destination
address is discarded
• Type/Length: type of network layer protocol (or length of
payload)
• Pad – used to produce valid frame >= 64 bytes
• Checksum – 32-bit cyclic redundancy check
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
23
24
CSMA with Collision Detection
• If two stations start transmitting simultaneously,
both detect collision and stop transmitting
• Monitor collision while sending
– Minimum time to detect collision => minimum frame
length
• Time divided into slots
– Length of slot = 2t = worst-case round-trip propagation
time
– To accommodate longest path, slot time = 512 bit
times = 51.2 msec (10Mbps Ethernet) => min frame
length: 51.2 msec X 10 Mbps = 512 b = 64 byte
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
25
Ethernet MAC Sublayer Protocol
• Connectionless: No handshaking between sending
and receiving NICs
– Ethernet resides in the Network Interface Card (NIC)
• Unreliable: receiving NIC doesn’t send acks or nacks
to sending NIC
– stream of datagrams passed to network layer can have gaps
(missing datagrams)
– gaps will be filled if app is using TCP
– otherwise, app will see gaps
• Ethernet’s MAC protocol: CSMA/CD
4/10/2016
EEC-484/584: Computer Networks
5-25
26
Ethernet CSMA/CD algorithm
1. NIC receives datagram from 4. If NIC detects another
network layer, creates frame
transmission while
transmitting, aborts and
2. If NIC senses channel idle,
sends jam signal
starts frame transmission If
NIC senses channel busy,
5. After aborting, NIC enters
waits until channel idle, then
exponential backoff: after
transmits
mth collision, NIC chooses K
at random from
3. If NIC transmits entire frame
{0,1,2,…,2m-1}. NIC waits
without detecting another
K·512 bit times, returns to
transmission, NIC is done
Step 2
with frame !
4/10/2016
EEC-484/584: Computer Networks
5-26
27
Randomization and
Binary Exponential Backoff
• After 1st collision, station picks 0 or 1 at random, waits
that number of slots and tries again
• After 2nd collision, station picks 0,1,2,3 at random, waits
that number of slots and tries again
• ….
• After i-th collision, station picks 0,1,…,2i-1 at random, …
• If 10 <= i < 16, station picks 0,1,…,210-1 at random
• If i=16, controller reports failure to computer
Why randomization is needed?
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
28
Ethernet Performance
• Binary exponential backoff results in
– Low delay when few stations collide
– Reasonable delay for collision resolution
when many stations collide
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
29
Exercise
• An IP packet to be transmitted by Ethernet
is 60 bytes long. Is padding needed in the
Ethernet frame, and if so, how many
bytes?
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao
30
Exercise
• Consider building a CSMA/CD network
running at 1 Gbps over a 1-km cable. The
signal speed in the cable is 200,000
km/sec. What is the minimum frame size?
4/10/2016
EEC-484/584: Computer Networks
Wenbing Zhao