1
CSC-362 Computer Networks
Week-6 Lecture-11-12
2
Instructor Contact Details
Name: Mr. Attique Ur Rehman
Course Instructor: CSC362- Computer Networks
Credit Hours: (3+1)=4
Office Location: 2nd Floor Computer Science Faculty Office:
41-C
Email:
[email protected] Visiting Hours: Wednesday (11:30 am -1:00 pm)
Lahore Garrison University
3
Course Material
Reference books
Many textbooks on Networking may be consulted
Research papers!
RFCs and Internet drafts
Related to TCP/IP suite and other protocols
Web resources
Tutorials, white papers, reports, etc.
Lahore Garrison University
4
Text Book
Computer Networks: A Systems Approach by Larry L. Peterson and Bruce S. Davies.
Third Edition [2003], Morgan Kaufmann Publishers, San Mateo, California, USA
Computer Networks by Andrew S. Tanenbaum
Fifth Edition
Data Communication and Computer Networks, by Behrouz A. Forouzan
5th Edition
Data and Computer Communications by William Stallings
10th Edition
Computer Networking: A Top-Down Approach Featuring the Internet by James F. Kurose and Keith W. Ross
6th edition
Lahore Garrison University
5
What we know
Elements of networks: nodes and links
Building a packet abstraction on a point-to-point link
transmission methods and challenges
limiting factors on data rates
defining units of communication data
detecting transmission errors
simulating an error-free channel
Sliding window mechanism
Lahore Garrison University
6
OSI
Application
Presentation
Session LOGICAL LINK sublayer
Transport Framing
Network
Error control
Data Link
Flow control
Physical
MEDIA ACCESS sublayer
Transmission/reception of
frames
7
The Medium Access Sublayer
THE CHANNEL ALLOCATION
PROBLEM
MULTIPLE ACCESS
PROTOCOLS
IEEE STANDARD 802 FOR LANs
Lahore Garrison University
8
The Channel Allocation
Problem
How to allocate a single broadcast channel among competing users?
Static
FDM /TDM (Frequency/Time Division Multiplexing)
FDM : Radio/TV broadcasts
TDM : POTS (Plain Old Telephone System)
GSM uses both (Global System for Mobile Communications)
Wasteful of bandwidth
Dynamic
Pure/ Slotted ALOHA
Carrier Sense Multiple Access (CSMA) Protocols
CSMA, CSMA/CD, CSMA/CA
Collision free protocols
Lahore Garrison University
9
Multiple-access protocols
Lahore Garrison University
10
Random Access
In random access or contention methods
No station is superior to another station and none is
assigned the control over another.
No station permits, or does not permit, another station to
send.
At each instance, a station that has data to send uses a
procedure defined by the protocol to make a decision on
whether or not to send.
Lahore Garrison University
11
Random Access
Pure ALOHA
Slotted ALOHA
CSMA
CSMA/CD
CSMA/CA
Lahore Garrison University
12
Basic Assumption for Dynamic
Channel Allocation
Station Model
Single Channel Assumption
Collision Assumption
Continuous Time or Slotted Time
Carrier Sense or No carrier Sense
Note: word ” carrier” in this sense refer to as electrical signal on
the cable
Lahore Garrison University
13
Pure ALOHA
1970, Norman Abramson, U. of Hawaii
Users transmit whenever they have data
When collision occurs, wait for a random amount of time and send
again
Retransmission is required for collisions (e.g. LLC sublayer or TCP)
Hosts wait a timeout for an ACK.
If no ACK by timeout, then wait a randomly selected delay to avoid
repeated collisions, then retransmit
Probability of collision increases with number of transmitting nodes
Assuming Poisson arrivals, maximum throughput achieved at 18%
load
Lahore Garrison University
14
Pure ALOHA
Lahore Garrison University
15
Pure ALOHA
Lahore Garrison University
16
Pure ALOHA
Lahore Garrison University
17
Example 1
The stations on a wireless ALOHA network are a maximum of 600 km apart. If we assume that signals
propagate at 3 × 108 m/s, we find
Tp = (600 × 103 ) / (3 × 108 ) = 2 ms.
Now we can find the value of TB for different values of
K.
a. For K= 1, the range is {0, 1}. The station needs to|
generate a random number with a value of 0 or 1. This
means that TB is either 0 ms (0 × 2) or 2 ms (1 × 2),
based on the outcome of the random variable.
For K= 2, the range is {0, 1, 2, 3}. This means that TB
can be 0, 2, 4, or 6 ms, based on the outcome of the
random variable.
c. For K = 3, the range is {0, 1, 2, 3, 4, 5, 6, 7}. This
means that TB can be 0, 2, 4, . . . , 14 ms, based on the
outcome of the random variable.
d. We need to mention that if K > 10, it is normally set to
10.
Lahore Garrison University
18
Vulnerable Time in Pure ALOHA
Lahore Garrison University
19
Example 2
A pure ALOHA network transmits 200-bit frames on a shared channel of 200 kbps.
What is the requirement to make this frame collision-free?
Solution: Average frame transmission time T fr is 200 bits/200 kbps or 1 ms. The
vulnerable time is 2 × 1 ms = 2 ms. This means no station should send later than 1 ms
before this station starts transmission and no station should start sending during the one
1-ms period that this station is sending.
Lahore Garrison University
Pure ALOHA – Performance 20
Analysis
The throughput for pure ALOHA is
S = G × e −2G .
The maximum throughput
Smax = 0.184 when G= (1/2).
Lahore Garrison University
21
Pure ALOHA – Performance
Analysis
Lahore Garrison University
22
Example 3
A pure ALOHA network transmits 200-bit frames on a shared channel of 200 kbps.
What is the throughput if the system (all stations together) produces
a. 1000 frames per second b. 500 frames per second
c. 250 frames per second.
Lahore Garrison University
23
Example 3
Solution
The frame transmission time is 200/200 kbps or 1 ms.
a. If the system creates 1000 frames per second, this is 1
frame per millisecond. The load is 1. In this case
S = G× e−2 G or S = 0.135 (13.5 percent). This means
that the throughput is 1000 × 0.135 = 135 frames. Only
135 frames out of 1000 will probably survive.
If the system creates 500 frames per second, this is
(1/2) frame per millisecond. The load is (1/2). In this
case S = G × e −2G or S = 0.184 (18.4 percent). This
means that the throughput is 500 × 0.184 = 92 and that
only 92 frames out of 500 will probably survive. Note
that this is the maximum throughput case,
percentagewise.
c. If thesystem creates 250 frames per second, this is (1/4)
frame per millisecond. The load is (1/4). In this case
S = G × e − 2G
or S = 0.152 (15.2 percent). This means
that the throughput is 250 × 0.152 = 38. Only 38
frames out of 250 will probably survive.
Lahore Garrison University
24
Slotted ALOHA
1972, Roberts
Slotted Aloha is an improvement over classical Aloha
Divide time into discrete intervals
All transmitters are synchronized to define fixed time slots
No coordination of medium access or resolution of collisions (like Aloha)
Operation
Stations attempt to transmit only at the beginning of a time slot
If transmissions from two or more stations overlap, there is a collision
Retransmission is required for collisions (e.g,LLC sub-layer or TCP )
Doubles the maximum throughput
Node with new arriving packet: transmit at beginning of next slot
If collision: retransmit packet in future slots with probability p , until
Lahore Garrison University
successful
25
Slotted Aloha
Lahore Garrison University
26
Slotted ALOHA
Rather than sending a packet at any time, send along time slot
boundaries Collision are confined to one time slot
Lahore Garrison University
27
Slotted ALOHA
Lahore Garrison University
28
Slotted ALOHA
The throughput for slotted ALOHA is
S = G × e−G .
The maximum throughput
Smax = 0.368 when G = 1.
Lahore Garrison University
29
Slotted ALOHA
Collision occurs if two or more stations receive
new packets during the preceding time slot
One central station transmits a synchronization
pulse
Assuming Poisson arrivals, maximum through
achieved at 36% load
Compared to 18% for classical Aloha, where
collision occurs if two or more stations receive new
packets during the preceding or current “time slot”
Lahore Garrison University
30
Example 4
A slotted ALOHA network transmits 200-bit frames on a shared channel of 200
kbps. What is the throughput if the system (all stations together) produces
a. 1000 frames per second
b. 500 frames per second
C. 250 frames per second.
Lahore Garrison University
31
Example 4
Solution
The frame transmission time is 200/200 kbps or 1 ms.
a. If the system creates 1000 frames per second, this is 1
frame per millisecond. The load is 1. In this case
S = G× e−G or S = 0.368 (36.8 percent). This means
that the throughput is 1000 × 0.0368 = 368 frames.
Only 386 frames out of 1000 will probably survive.
b. If the system creates 500 frames per second, this is
(1/2) frame per millisecond. The load is (1/2). In this
case S = G × e−G or S = 0.303 (30.3 percent). This
means that the throughput is 500 × 0.0303 = 151.
Only 151 frames out of 500 will probably survive.
c. If the system creates 250 frames per second, this is (1/4)
frame per millisecond. The load is (1/4). In this case
S = G × e −G or S = 0.195 (19.5 percent). This means
that the throughput is 250 × 0.195 = 49. Only 49
frames out of 250 will probably survive.
Lahore Garrison University
32
Comparison Between Pure and
Slotted Aloha
Slotted ALOHA is more efficient than
ALOHA because when there is a
collision, the wasted time is confined to
one time slot
ALOHA & slotted ALOHA are
inefficient because hosts don’t take into
account what other hosts are doing before
they transmit
Lahore Garrison University
33
Carrier Sense Multiple
Access (CSMA)
Carrier Sense Multiple Access (CSMA) further improves Aloha by
“listening before transmitting”
Can significantly reduce the probability of a collision
Operation
Node wishing to transmit data first sense the channel
A node can only transmit if the medium is sensed idle
If channel sensed busy, defer transmission
Human analogy: don’t interrupt others!
Transmissions from two or more stations can still overlap
collisions can occur
Retransmission is required for collisions (e.g., LLC sublayer or
TCP)
Lahore Garrison University
34
CSMA “Persistence”
“Persistence” deals with how CSMA responds when
channel becomes idle
Station transmits with probability p
Defers transmission until the next time slot with
probability 1-p
Most interesting values are p = 1 and p=0
Lahore Garrison University
CSMA – Carrier Sense 35
Multiple Access (LAN)
• 1-persistent
– When idle, transmit a frame
– When busy, continuously sensing
– When collision, wait for a random amount of time
• Non-persistent
– When idle, transmit a frame
– When busy, wait for a random amount of time
– When collision, wait for a random amount of time then re-sense
• p-persistent
– Slotted channels
– When idle, transmit with a probability p, defers until the next slot with
probability 1-p
•
Lahore Garrison University
36
Carrier Sense Multiple
Access (CSMA)
Lahore Garrison University
37
Carrier Sense Multiple
Access (CSMA)
Lahore Garrison University
38
1-Persistent CSMA (p=1)
When idle, transmit a frame
When busy,
continuously sensing
When channel becomes free, a host transmits its packet immediately
(with probability 1)
Collision Scenario
Hosts A and B are far apart (long prop. delay). A’s signal takes a long
time (Propagation delay problem)
Hosts B and C transmit as soon as A finishes (Even Propagation delay
is Zero)
Increased probability of collision due to two or more waiting stations
transmitting at about the same time
Still , CSMA is more efficient than ALOHA variants
Lahore Garrison University
39
Non-persistent or 0-persistent
( p = 0)
When idle, transmit a frame
If channel goes from busy to idle, station waits a random/sleep
amount of time and then senses the medium again
Repeated until channel is sensed to be idle
As with 1-persistent CSMA, as soon as channel is idle, then send a packet
Random interval reduces collisions
Reduced probability of collision after channel goes from busy to idle
Increased probability of under-utilization of channel
1-persistent better than 0-persistent if..
Offered load is light, or
Higher throughput than 1-persistent CSMA when many sender
Penalty for a collision is small (e.g., collision detection is in use)
Lahore Garrison University
40
p-Persistent CSMA
Generalization of 1-persistent CSMA
Typically applied to slotted channels
Slot length is chosen as maximum propagation delay
A host senses the channel, and
If slot is idle, transmit with probability p, or defer with
probability q =1-p
If next slot is idle, transmit with probability p, or defer
probability q =1-p repeat ...
If channel is busy, then sense channel continuously until it
becomes free, begin again
Lahore Garrison University
CSMA: Collisions Can Still Occur 41
…
Nodes start to transmit at about the same time (under heavy
load, > 1 node simultaneously sense the channel to be idle)
Detection time -- time to detect another station’s transmission
is a significant performance factor
Lahore Garrison University
42
CSMA/CD (Collision
Detection)
CSMA/CD: carrier sensing, deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted, reducing channel wastage
Collision detection:
Easy in wired LANs: measure signal strengths compare to
transmitted and received signals
Difficult in wireless LANs; can be costly
Human analogy: the polite conversationalist
Lahore Garrison University
43
CSMA/CD
Ethernet uses CSMA/CD, i.e. CSMA
with Collision Detection
“Listen-while-talk” protocol
A host listens even while it is
transmitting, and if a collision is
detected, stops transmitting
Lahore Garrison University
44
CSMA/CD
Can abort transmission sooner than end-of-packet if there is a collision
Can happen if propagation delays are long
Better efficiency than pure CSMA
CSMA/CD doesn’t require explicit acknowledgement
Unlike CSMA, which requires an ACK or timeout to detect a collision
Collision detection is built into the transmitter
When collision detected, begin retransmission
Lahore Garrison University
45
Collision of first bit in CSMA/CD
Lahore Garrison University
46
Collision and abortion in CSMA/CD
Lahore Garrison University
47
CSMA/CD
Exponential back-off strategy
When a collision is detected, a host waits for some randomly chosen time, then
retransmits a packet
If a second collision is detected, a host doubles the original wait time, then
retransmits the packet
Each time there is another collision, the wait time is doubled before retransmission
Variants:
At each retransmission, choose randomly from among a discrete set of values within
exponentially increasing wait time
Retransmit a finite # of times
Lahore Garrison University
48
CSMA/CD
Lahore Garrison University
49
Energy Levels
Lahore Garrison University
50
Efficiency of CSMA/CD
• Given collision detection, instead of wasting the whole packet
transmission time (a slot), we only waste the time needed to detect collision
• In the normal case, we try approximately e times before
each successful transmission, then for each successful
transmission, which takes P/C, we waste a total of 2eT (≈5T)
seconds on collision, where T is one-way propagation delay
P: packet size, e.g. 1000 bits
C: link capacity, e.g. 10Mbps
Lahore Garrison University
51
Example 5
A network using CSMA/CD has a bandwidth of 10 Mbps. If the
maximum propagation time (including the delays in the devices
and ignoring the time needed to send a jamming signal, as we see
later) is 25.6 μs, what is the minimum size of the frame?
Solution
The frame transmission time is Tfr = 2 × Tp = 51.2 μs. This
means, in the worst case, a station needs to transmit for a period of
51.2 μs to detect the collision. The minimum size of the frame is
10 Mbps × 51.2 μs = 512 bits or 64 bytes. This is actually the
minimum size of the frame for Standard Ethernet.
Lahore Garrison University
52
CSMA/CA
The CSMA/CA differ from the previous procedures in that there is no
collision/ avoid the collision.
The station uses one the persistent strategy.
If it find the line idle
the station waits an IFS (inter-frame space) amount of time.
It than wait random amount of time
After that it sends the frame and set the timer.
The station waits for ACK
if ACK received before timer expires, transmission is successful.
if ACK is not received before timer expires, something is wrong.
The station increments the value of backoff parameter.
wait for backoff amount of time and re-senses again
Lahore Garrison University
53
CSMA/CA
In CSMA/CA, if the station finds the channel busy, it does not restart the timer of
the contention window; it stops the timer and restarts it when the channel becomes
idle.
In CSMA/CA, the IFS can also be used to define the priority of a station or a frame.
Lahore Garrison University
54
CSMA/CA
Lahore Garrison University
55
CSMA/CA
Lahore Garrison University
56
Reading Assignment
Chapter NO:4
Collision-Free Protocols
A Bit-Map Protocol
Binary Countdown
Lahore Garrison University