LN cn04b Ethernet
LN cn04b Ethernet
LANS: Ethernet
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 2
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 3
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 4
with respect to p.
d
f (p) = n(1 − p)n−1 + np(n − 1)(−1)(1 − p)n−2
dp
= n(1 − p)n−2 ((1 − p) − (n − 1)p)
d
• If you set dp f (p) = 0 we see that
1 − p − (n − 1)p = 0.
• Hence, p = 1/n.
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 5
Pmax := Pr[Success]
n−1
1 1
= n 1−
n n
n−1
1
= 1−
n
≈ 1/e.
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 6
Limits of Contention
The only way to improve the performance of contention is by
limiting the number of users.
Pr [Success]
1/e
0
Number of contenders
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 7
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 8
Transmission Contention
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 9
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 10
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 11
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 12
Backoff Protocols
• Based on a probability distribution and a queue.
• There is a queue of stations (nodes) waiting to transmit.
• Each station (node) keeps track of the number of attempts to
transmit
• A function p(x) (known to all hosts) is defined in advance:
– p(x) is the probability you transmit in the x-th attempt
– same function is used by all nodes
– p(x) decreasing in x
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 13
Backoff Algorithms
• Implementation is done as follows.
– Station i has a variable bcki and uses the following protocol:
1. Initialize bcki to 0;
2. Station attempts transmission if queue is not empty with
probability p(bcki );
(a) if it fails to transmit due to collision it increments the
variable bcki ;
(b) Else it assigns 0 to the variable bcki ;
3. If queue is empty and no transmission is made the
variable bcki remains unchanged.
• Major concern:
how stable is traffic under various functions p(x)?
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 14
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 15
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 16
Ethernet CSMA/CD
• CSMA (Carrier Sense Multiple Access)
1. A station wishing to transmit must first listen for existing
traffic on the line.
2. If no voltage detected, the line is considered to be idle and a
transmission is initiated.
• CD (Collision Detection)
1. If no voltage detected, a transmission is initiated. During
transmission, station checks line for extremely high voltages
that indicate collisions.
2. If collision detected station waits a predetermined amount
of time for the line to clear (backoff) and sends data again.
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 17
A B
Collision!
1. After 1st collision, each station “waits at random” either 0 or 1
time slots and tries again.
2. If they pick same random value they collide again. After 2nd
collision, each station “waits at random” either 0 or 1 or 2 or 3
time slots and tries again.
3. If they pick same random value they collide again. After 3rd
collision, each station “waits at random” either 0 or 1 or 2 or 3
or 4 or 5 or 6 or 7 time slots and tries again.
4. And so on...
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 18
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 19
Expected Time
• Suppose that two synchronous ethernet stations A, B are at
contention period t:
• This means, they have failed in previous contention periods
0, 1, . . . , t − 1, and are now in contention period t.
• They each pick a random number in the interval 0..2t − 1.
– A picks random value a in 0..2t − 1.
– B picks random value b in 0..2t − 1
• The expected number of steps to reach contention period t is
cumulative,
– i.e., you must add the “waiting times”, for all the trials
before t.
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 20
min{at , bt },
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 21
A B
What do I do now?
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 22
Slots
Frame Contention Frame Idle Frame
Transmission Contention
persistence
• When a station has data to send and line is busy it waits for
the line to go idle.
• How persistent is a transmitter in capturing an idle channel?
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 23
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 24
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 25
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 26
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 27
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 28
CSMA Performance
0.01 persistent
Nonpersistent
Throughput per packet time
0.5−persistent
CSMA
1−perstent
CSMA
Slotted Aloha
Pure Aloha
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 29
Ethernet CSMA-CD
CSMA improves over Aloha because it senses the carrier.
Still, however, collisions involve entire packets!
An obvious improvement is to abort transmission when collision is
detected!
1. Station senses channel
2. if channel idle then transmit
3. else use a CSMA strategy (p-, non-persistent)
4. if collision detected during transmision
5. then transmit jamming signal and abort transmission
6. schedule future transmission with backoff.
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 30
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 31
Time
A station is out of luck if it becomes ready just after its bit slot
passes by.
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 32
0 1 0 0 0 − − −
1 0 0 1 1 0 0 −
1 0 1 0 1 0 1 0 Winning Node
1 0 1 0 Result
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 33
Splitting Algorithms
• Idea is to partition set of nodes into “groups”.
• Each group is assigned to a slot.
• Thus a collision can only occur within a group.
• Example 1: Assume the nodes have unique (fixed length)
identifiers (e.g., 1, 2, . . . , m)
– Divide nodes into pairs.
– Node 2i or 2i + 1 goes in slot i
– If collision occurs they go in order
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 34
Paradigm
• Similar to US Army testing for syphilis. Take blood test from
n soldiers.
• A portion of each sample is poured into a single test tube. This
is tested for antibodies.
• If none found all soldiers in group declared healthy.
• If antibodies were found then split soldiers into two groups:
1..n/2 and n/2 + 1..n and iterate.
• Eventually all infected soldiers are found!
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 35
2 3
4 5 6 7
a b c d e f g h
During first slot any node of the tree rooted at 1 may contend.
If collision occurs, in next slot only nodes in left subtree (rooted at
2) may contend.
Again, if collision occurs, in next slot only nodes in left subtree
(rooted at 4) may contend.
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 36
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 37
Exercisesa
1. What is the difference between coordinated and uncoordinated
access?
2. Suppose that n nodes in uncoordinated contention select
1
p = kn , where k ≥ 1 is a given integer. What is the Pr[Success]
as a function of k? Derive the formula.
3. Suppose that in uncoordinated contention at any given time at
√
most n of the hosts contend for the channel. What is the
Pr[Success]?
4. What makes unslotted Aloha less efficient than slotted Aloha?
What is the tradeoff?
5. In what ways do exponential and polynomial backoff
algorithms differ?
a Do not submit.
October 5, 2019
Principles of Computer Networks, COMP 3203. Evangelos Kranakis, Carleton University, SCS 38
October 5, 2019