Data Communication Networks: Saad Mneimneh Computer Science Hunter College of CUNY New York
Data Communication Networks: Saad Mneimneh Computer Science Hunter College of CUNY New York
Lecture 9
Saad Mneimneh
Computer Science
Hunter College of CUNY
New York
Multiaccess networks . . . . . . . . . . .
Aloha. . . . . . . . . . . . . . . . . . . . . .
Probability of successful transmission
Expected number of arrivals . . . . . .
Stability . . . . . . . . . . . . . . . . . . . .
Stabilizing Aloha . . . . . . . . . . . . . .
Blocking packets . . . . . . . . . . . . . .
Stability after blocking . . . . . . . . . .
p small enough... . . . . . . . . . . . . . .
Maintaining g(n) = 1 . . . . . . . . . . .
Estimating n . . . . . . . . . . . . . . . . .
Delay(assuming you know M/G/1) . . .
CSMA Aloha. . . . . . . . . . . . . . . . .
Expected slot length. . . . . . . . . . . .
Stability of CSMA . . . . . . . . . . . . .
CSMA/CD Aloha Ethernet . . . . .
Expected slot length. . . . . . . . . . . .
Throughput of CSMA/CD . . . . . . .
Ethernet . . . . . . . . . . . . . . . . . . . .
Ethernet algorithm . . . . . . . . . . . . .
Why 2 ? . . . . . . . . . . . . . . . . . . .
Ethernet technologies . . . . . . . . . . .
Token Ring . . . . . . . . . . . . . . . . . .
Ring as a Star . . . . . . . . . . . . . . . .
Token implementation . . . . . . . . . .
Idle token and busy token . . . . . . . .
Releasing the token . . . . . . . . . . . .
Issues to be considered . . . . . . . . . .
Frame format . . . . . . . . . . . . . . . .
FDDI . . . . . . . . . . . . . . . . . . . . . .
Analysis of FDDI . . . . . . . . . . . . . .
Analysis of FDDI (cont.) . . . . . . . . .
Analysis of FDDI (cont.) . . . . . . . . .
Analysis of FDDI (cont.) . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.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
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Multiaccess networks
Ethernet
Token Ring
Ethernet (IEEE 802.3), developed in the 1970s, uses an algorithm that has roots in the Aloha
protocol developed by the University of Hawai
Token Right (IEEE 802.5) uses an algorithm developed by IBM in the 1980s
Aloha
Aloha (simplified version): each node with a packet at the beginning of a slot (backlogged node),
transmits with probability p
n
p(1 p)n1
1
np np
e
npenp = g(n)eg(n)
1p
( t)x e m t
P r[N (t) = x] = m
(Poisson)
x!
Stability
1/e
g(n)e-g(n)
n=0
g(n)=1
n=m
Stabilizing Aloha
We will look at two ways for stabilizing Aloha:
Blocking packets
n=0
n=m0
horizontal line in previous figure becomes oblique
The oblique line will possibly cross the curve at another stable point
1/e
g(n)e-g(n)
(1-n/m)
undesired
stable point
n=0
n=m
Crossing the unstable point will now lead to another stable point
The second stable point, however, is not desired
g(n)=1
The undesired stable point can be eliminated by making p small enough for the line to move inside
the curve
p small enough...
mp
log mp
mp
Now
log
e log = (1
)
mp
mp log mp
mp
log
=(
)
mp
mp
mp
mp = 2 log
m
log m
(1/p)
Maintaining g(n) = 1
1/e
g(n)e-g(n)
n=0
g(n)=1
n=m
1
)
n
The min operation ensures that p will never exceed 1 when the estimate n
is too small
Estimating n
The estimated backlog n
is updated at the beginning of each slot k
n
k =
max(, n
k1 + 1) for 0 or 1 feedback (idle or success)
1
n
k1 + + e2
for e feedback (collision)
1
E[nk nk1 ] = ( 1)2/e + ( + e2
)(1 2/e) = 1/e
this is the correct expected increment in backlog
But is unknown use fixed = 1/e for all actual (unknown) < 1/e
Delay
(assuming you know M/G/1)
i1
X = e, X 2 = 2e2 e, V = 1, V 2 = 1
W =
X 2
V2
(2e2 e) 1
+
=
+
2(1 e)
2
2(1 X) 2V
T =W +X =
(2e2 e) 1
+ +e
2(1 e)
2
CSMA Aloha
In many systems, a node can hear whether other nodes are transmitting, thus the name Carrier
Sensing Multiple Access (CSMA)
This can happen after a time equal to the propagation delay of the channel, say << 1 slot
Therefore, the feedback 0 (for idle) is obtained after a slot of length (rather than at the end of
a complete slot)
CSMA
sense the channel for an idle slot
if idle after << 1
then transmit your packet with probability p (Aloha)
CSMA
else continue the current slot (busy slot)
CSMA
m(1 e m [+1+e
g(n) ]
g(n)eg(n)
+ 1 eg(n)
Stability of CSMA
1/(1+2 )
CSMA
Aloha
g(n)=2
, when g(n)
CSMA can be stabilized using the same technique of estimating n described previously for pure
Aloha (but a bit more involved)
1+
In addition to carrier sensing, it may be possible for a node to listen to the channel while
transmitting
If two nodes transmit almost simultaneously, they can detect a collision after the propagation
delay of the channel << 1 slot
This justifies the name CSMA with Collision Detection, CSMA/CD, e.g. the Ethernet
Therefore, a e feedback is obtained after two slots of length << 1 each (rather than at the end
of a complete slot)
A 1 feedback is now implicit
CSMA/CD
sense the channel
if idle after << 1 (idle slot)
then transmit your packet with probability p (Aloha)
CSMA/CD
else if collision after 2 << 1 (collision slot)
then CSMA/CD
else continue the current slot (busy slot)
CSMA/CD
g(n)eg(n)
+ g(n)eg(n) + (1 eg(n) g(n)eg(n) )
Throughput of CSMA/CD
g(n)eg(n)
+ g(n)eg(n) + (1 eg(n) g(n)eg(n) )
<
1
1 + 3.31
Better than CSMA if 3.31 < 2 < 0.183 (e.g. in Ethernet, 0.021)
Packets may be of different lengths, as long as the length is multiple of
The analysis of CSMA did not account for variable length packets
one can show that the expected length of a collison slot is relatively large
must wait until all packets finish to detect a collision
with variable size, this is more than just one slot
Ethernet
source
type
body
The address of an Ethernet node is hard coded into the Ethernet network adaptor (network card),
e.g. 8:0:2b:e4:b1:2
Ethernet algorithm
after a collision wait for some time using exponential backoff, i.e. doubling delay
1st attempt: immediate after sensing
2nd attempt: wait 0 or 2 uniformly, then start sensing
3rd attempt: wait 0, 2, 4, 6 uniformly, then start sensing
k th attempt: wait 2k, k chosen uniformly in [0, 2 k1 1], then start sensing
Receiver algorithm: Ethernet adaptor receives all frames (CSMA/CD) and accepts
Why 2 ?
With an unslotted system, collision requires a time of 2 (i.e. RTT) after transmission to be
detected
Ethernet technologies
coax
thin coax
twisted pair
10Base5
10Base2
10BaseT
500 m
200 m
100 m
10 Mbps (twisted pair can support 100 Mpbs and 1000 Mbps)
at most 4 repeaters between any two nodes (10Base5)
up to 1024 nodes
Token Ring
A token circulates
A node with a frame holds the token and transmits its frame instead
The node then releases the token
Round robin service, fair if all framess have the same size
Ring as a Star
4 Mbps or 16 Mbps
250 nodes
twisted pair
Several relays are grouped together in a box making the ring look like a star
Token implementation
must make sure that what is being received and discarded has already reached its destination
e.g. the node can be receiving its own frame if it is long enough
Token: let token denote beginning or end of frame (e.g. flag 01111110 if bit framing is used)
when a node finishes transmisson, it places 01111110 (idle token) at the end of the frame (as usual)
when next node reads the token
10
01111110
01111111
011
11
110
01111
111
(early release) either transmit the IT immediately, followed by idle fill until BT is seen
BT
transmitted
received
packet
IT
idle fill
BT
packet returns
BT
BT
token
grabbed
(delayed release) or transmit idle fill until packet completely returns, then IT, followed by idle
fill until BT is seen
transmitted
received
BT
packet
BT
idle fill
packet returns
IT
idle fill
idle fill
BT
BT
token
grabbed
Issues to be considered
Token length: round trip delay must be at least as large as token length; otherwise, a node will
discard part of the token as it returns
nodes may add delay (not just one bit) nodes must have buffers
i.e. ring must have enough storage to hold the token
Priority: priority field can be added in a fixed position after the (idle or busy) token (or as part of
the token)
Frame format
start AC
FC
token
start AC
FC
destination
source
data
CRC
end
FS
end
frame
when a nodes reads the token (idle token), it can simply change the frame control field and
then add the rest of its frame
what we previosuly called busy token is now just the beginning of the frame header
the A bit: destination node sets this when it sees the frame
the C bit: destination node sets this if it successfully stores the frame
FDDI
FDDI does not use priority reservation as described earlier (therefore, no AC field in the frame format)
When ring is initialized, a parameter T T RT (Target Token Rotation
P Time) is set
Each node i is allocated a time i to send its high priority traffic, j j T T RT
Analysis of FDDI
Let T = m1
j=0 j T T RT
Let ti be the time at which the token reaches node i mod m for the (bi/mc + 1) th time
Based on the FDDI algorithm:
P
ti+1
ti+1
But
Pi1
j=im j
i
X
j=0
j max(ti
Pm1
j=0
i1
X
j=0
j , tim
j = T , let t0i = ti
im1
X
j=0
Pi1
j=0 i
j + T T RT
i1
X
k=i+jm
k , j m
= ti
i1
X
k=0
t0i ti+jm
k ti+jm +
i+j+m1
X
k=0
i1
X
k=i+jm
i1
X
k=i+jm
t0i t0i+jm
k +
i1
X
k=0
i1
X
k=i+jm
i1
X
j=im
j )
0
0*
T T RT + T
2T T RT + T
3T T RT + T
3T T RT + 2T *
t0
1
T T RT + 0
T T RT + T + 0 *
2T T RT + T + 0
3T T RT + T + 0
4T T RT + T + 0
0
0*
T T RT
2T T RT T
3T T RT 2T
3T T RT 2T *
1
T T RT
T T RT *
2T T RT T
3T T RT 2T
4T T RT 3T
2
T T RT + 0 + 1
2T T RT + 0 + 1
2T T RT + T + 0 + 1 *
3T T RT + T + 0 + 1
4T T RT + T + 0 + 1
2
T T RT
2T T RT
2T T RT
3T T RT
4T T RT
T
T *
2T
3T
Analysis
of FDDI (cont.)
(Average rotation time) Consider token makes m + 1 cycles around the ring
t0i+m(m+1) t0i + m(T T RT T )
i+m(m+1)1
ti+m(m+1)
X
j=0
j t i +
i1
X
j=0
j m(T T RT T )
ti+m(m+1) ti
m
T
T T RT +
T T RT
m+1
m+1
m+1
(Low priority traffic) For each of the m + 1 cycles, each node i can send low priority traffic for a at least
T T RT ti ; therefore, each node is given at least
(m + 1)T T RT [m(T T RT T ) + (m + 1)T ] = T T RT T
for its low priority traffic, an average time of
T T RT T
m+1
per cycle