Computer Networks
Computer Networks
Computer Networks
PART II
LAN Protocols: - Static & Dynamic channel allocation in LANs and WANs, Multiple
access protocols ALOHA Pure ALOHA Slotted ALOHA Carrier Sense Multiple
Access protocols persistent and non-persistent CSMA CSMA with collision detection
IEEE 802.3 standards for LAN
1
1. Station Model. The model consists of N independent stations (e.g., computers,
telephones, or personal communicators), each with a program or user that generates
frames for transmission. Stations are sometimes called terminals. The probability of a
frame being generated in an interval of length t is t, where is a constant (the arrival
rate of new frames). Once a frame has been generated, the station is blocked and does
nothing until the frame has been successfully transmitted.
The first one says that stations are independent and that work is generated at a
constant rate. It also implicitly assumes that each station only has one program or user, so
while the station is blocked, no new work is generated. More sophisticated models allow
multi-programmed stations that can generate work while a station is blocked, but the
analysis of these stations is much more complex.
2. Single Channel Assumption. A single channel is available for all communication. All
stations can transmit on it and all can receive from it. As far as the hardware is concerned,
all stations are equivalent, although protocol software may assign priorities to them.
3. Collision Assumption. If two frames are transmitted simultaneously, they overlap in
time and the resulting signal is garbled. This event is called a collision. All stations can
detect collisions. A collided frame must be transmitted again later. There are no errors
other than those generated by collisions.
4a. Continuous Time. Frame transmission can begin at any instant. There is no master
clock dividing time into discrete intervals.
4b. Slotted Time. Time is divided into discrete intervals (slots). Frame transmissions
always begin at the start of a slot. A slot may contain 0, 1, or more frames, corresponding
to an idle slot, a successful transmission, or a collision, respectively.
5a. Carrier Sense. Stations can tell if the channel is in use before trying to use it. If the
channel is sensed as busy, no station will attempt to use it until it goes idle.
5b. No Carrier Sense. Stations cannot sense the channel before trying to use it. They just
go ahead and transmit. Only later can they determine whether the transmission was
successful.
2
Multiple access protocols
Many algorithms for allocating a multiple access channel are known.
ALOHA
Norman Abramson devised a new and elegant method to solve the channel
allocation problem. The ALOHA system, used ground-based radio broadcasting, the basic
idea is applicable to any system in which uncoordinated users are competing for the use
of a single shared channel.
Two versions of ALOHA here:
Pure ALOHA
Slotted ALOHA.
They differ with respect to whether time is divided into discrete slots into which all
frames must fit. Pure ALOHA does not require global time synchronization; slotted
ALOHA does.
Pure ALOHA
The basic idea of an ALOHA system is simple: let users transmit whenever they
have data to be sent. There will be collisions, of course, and the colliding frames will be
damaged. However, due to the feedback property of broadcasting, a sender can always
find out whether its frame was destroyed by listening to the channel, the same way other
users do. With a LAN, the feedback is immediate; with a satellite, there is a delay of 270
msec before the sender knows if the transmission was successful. If listening while
transmitting is not possible for some reason, acknowledgements are needed. If the frame
was destroyed, the sender just waits a random amount of time and sends it again. The
waiting time must be random or the same frames will collide over and over, in lockstep.
Systems in which multiple users share a common channel in a way that can lead to
conflicts are widely known as contention systems.
A sketch of frame generation in an ALOHA system is given in Fig. 1. We have
made the frames all the same length because the throughput of ALOHA systems is
3
maximized by having a uniform frame size rather than by allowing variable length
frames.
Whenever two frames try to occupy the channel at the same time, there will be a
collision and both will be garbled. If the first bit of a new frame overlaps with just the last
bit of a frame almost finished, both frames will be totally destroyed and both will have to
be retransmitted later. The checksum cannot (and should not) distinguish between a total
loss and a near miss.
(Poisson distribution is a discrete probability distribution that expresses the
probability of a given number of events occurring in a fixed interval of time and/or space
if these events occur with a known average rate and independently of the time since the
last event)
Let the ''frame time'' denote the amount of time needed to transmit the standard,
fixed-length frame (i.e., the frame length divided by the bit rate). At this point we assume
that the infinite population of users generates new frames according to a Poisson
distribution with mean N frames per frame time. If N > 1, the user community is
generating frames at a higher rate than the channel can handle, and nearly every frame
will suffer a collision. For reasonable throughput we would expect 0 < N < 1.
4
A frame will not suffer a collision if no other frames are sent within one frame time of its
start, as shown in Fig. 2. Under what conditions will the shaded frame arrive undamaged?
Let t be the time required to send a frame. If any other user has generated a frame
between time t0 and t0 + t, the end of that frame will collide with the beginning of the
shaded one. In fact, the shaded frame's fate was already sealed even before the first bit
was sent, but since in pure ALOHA a station does not listen to the channel before
transmitting, it has no way of knowing that another frame was already underway.
Similarly, any other frame started between t0 + t and t0 + 2t will bump into the end of the
shaded frame.
In addition to the new frames, the stations also generate retransmissions of frames
that previously suffered collisions. Let us further assume that the probability of k
transmission attempts per frame time, old and new combined, is also Poisson, with mean
G per frame time. [G -Offered Load: Expected number of transmission and
retransmission attempts (from all users) per time unit] Clearly, G>= N. At low load (i.e.,
N ~ 0), there will be few collisions, hence few retransmissions, so G ~N. At high load
there will be many collisions, so G > N.
Under all loads, the throughput, S[ S Throughput: Expected number of
successful transmissions per time unit , Normalization: Frame transmission time is 1
,Maximum throughput is 1 ], is just the offered load, G, times the probability, P0, of a
transmission succeedingthat is, S = GP0, where P0 is the probability that a frame does
not suffer a collision.
5
The probability that k frames are generated during a given frame time is given by the
Poisson distribution:
Prob [k frames generated in 1 frame time] = (Gke-G)/k!
Pr [k ] = (Gke-G)/k!
so the probability of zero frames is just e-G. In an interval two frame times long, the
mean number of frames generated is 2G. The probability of no other traffic being
-2G
initiated during the entire vulnerable period is thus given by P0 = e . Using S = GP0,
we get
The relation between the offered traffic and the throughput is shown in Fig. 3. The
maximum throughput occurs at G = 0.5, with S = 1/2e, which is about 0.184. In other
words, the best we can hope for is a channel utilization of 18 percent. This result is not
very encouraging, but with everyone transmitting at will, we could hardly have expected
a 100 percent success rate.
Advantages:
Superior to fixed assignment when there are a large number of bursty stations.
Adapts to varying number of stations.
6
Disadvantages:
Slotted ALOHA
In 1972, Roberts published a method for doubling the capacity of an ALOHA system.
7
In Roberts' method, which has come to be known as slotted ALOHA, in contrast to
Abramson's pure ALOHA, a computer is not permitted to send whenever a carriage
return is typed. Instead, it is required to wait for the beginning of the next slot. Thus, the
continuous pure ALOHA is turned into a discrete one. Since the vulnerable period is now
halved, the probability of no other traffic during the same slot as our test frame is e-G
which leads to
As you can see from Fig. 3, slotted ALOHA peaks at G = 1, with a throughput of S =1/e
or about 0.368, twice that of pure ALOHA. If the system is operating at G = 1, the
probability of an empty slot is 0.368 (from Eq.Pr[k]). The best we can hope for using
slotted ALOHA is 37 percent of the slots empty, 37 percent successes, and 26 percent
collisions. Operating at higher values of G reduces the number of empties but increases
the number of collisions exponentially. To see how this rapid growth of collisions with G
comes about, consider the transmission of a test frame. The probability that it will avoid a
collision is e-G, the probability that all the other users are silent in that slot. The
probability of a collision is then just 1 - e-G. The probability of a transmission requiring
exactly k attempts, (i.e., k - 1 collisions followed by one success) is
8
Advantages:
Disadvantages:
Non-Persistent CSMA
1-Persistent CSMA
p-Persistent CSMA
9
(i) 1-persistent CSMA: In this case, a node having data to send, start sending, if the
channel is sensed free. If the medium is busy, the node continues to monitor until the
channel is idle. Then it starts sending data.
(ii) Non-persistent CSMA: If the channel is sensed free, the node starts sending the
packet. Otherwise, the node waits for a random amount of time and then monitors the
channel.
(iii) p-persistent CSMA: If the channel is free, a node starts sending the packet. Otherwise
the node continues to monitor until the channel is free and then it sends with probability
p.
The first carrier sense protocol that we will study here is called 1-persistent
CSMA (Carrier Sense Multiple Access). When a station has data to send, it first listens to
the channel to see if anyone else is transmitting at that moment. If the channel is busy, the
station waits until it becomes idle. When the station detects an idle channel, it transmits a
frame. If a collision occurs, the station waits a random amount of time and starts all over
again. The protocol is called 1-persistent because the station transmits with a probability
of 1 when it finds the channel idle. [In computer networks, propagation delay is the
amount of time it takes for the head of the signal to travel from the sender to the
receiver.]
The propagation delay has an important effect on the performance of the protocol.
There is a small chance that just after a station begins sending, another station will
become ready to send and sense the channel. If the first station's signal has not yet
reached the second one, the latter will sense an idle channel and will also begin sending,
resulting in a collision. The longer the propagation delay, the more important this effect
becomes, and the worse the performance of the protocol.
10
Even if the propagation delay is zero, there will still be collisions. If two stations
become ready in the middle of a third station's transmission, both will wait politely until
the transmission ends and then both will begin transmitting exactly simultaneously,
resulting in a collision. If they were not so impatient, there would be fewer collisions.
Even so, this protocol is far better than pure ALOHA because both stations have the
decency to desist from interfering with the third station's frame. Intuitively, this approach
will lead to a higher performance than pure ALOHA. Exactly the same holds for slotted
ALOHA.
Summary
When a station has to send data it first listens to the channel to see if anyone else is
transmitting. If the channel is busy the station waits until it becomes idle, When the
station detects an idle channel, it transmits a frame. If a collision occurs, the station waits
a random amount of time and starts all over again.
2. if idle, send
11
station senses the channel. If no one else is sending, the station begins doing so itself.
However, if the channel is already in use, the station does not continually sense it for the
purpose of seizing it immediately upon detecting the end of the previous transmission.
Instead, it waits a random period of time and then repeats the algorithm. Consequently,
this algorithm leads to better channel utilization but longer delays than 1-persistent
CSMA.
Summary
2. If the medium is busy, wait a random amount of time and repeat Step 1
The last protocol is p-persistent CSMA. It applies to slotted channels and works
as follows. When a station becomes ready to send, it senses the channel. If it is idle, it
transmits with a probability p. With a probability q = 1 - p, it defers until the next slot. If
that slot is also idle, it either transmits or defers again, with probabilities p and q. This
process is repeated until either the frame has been transmitted or another station has
begun transmitting. In the latter case, the unlucky station acts as if there had been a
collision (i.e., it waits a random time and starts again). If the station initially senses the
channel busy, it waits until the next slot and applies the above algorithm. Figure 5 shows
12
the computed throughput versus offered traffic for all three protocols, as well as for pure
and slotted ALOHA.
Summary
This protocol applies to slotted channels. When a station becomes ready to send it sends
the channel. If it is idle it transmits with a probability p.
1. If the medium is idle, transmit with probability p, and delay for one time unit with
probability (1 - p) (time unit = length of propagation delay).
2. If the medium is busy, continue to listen until medium becomes idle, then go to Step
1
4. If p=1, station can transmit the frame whenever the channel is idle. If p=0 station
always wait.
If a collision has occurred, the channel is unstable until colliding packets have been fully
transmitted. CSMA/CD overcome this difficulty.
13
Carrier Sense Multiple Access with Collision Detection (CSMA/CD)
If two stations sense the channel to be idle and begin transmitting simultaneously,
they will both detect the collision almost immediately. Rather than finish transmitting
their frames, which are irretrievably garbled anyway, they should abruptly stop
transmitting as soon as the collision is detected. Quickly terminating damaged frames
saves time and bandwidth. This protocol, known as CSMA/CD (CSMA with Collision
Detection) is widely used on LANs in the MAC sub-layer. In particular, it is the basis of
the popular Ethernet LAN. While transmitting, the sender is listening to medium for
collisions. Sender stops if collision has occurred.
Use one of the CDMA persistence algorithm (non-persistent, 1-persistent, p-
persistent) for transmission.
If a collision is detected during transmission, cease transmission and transmit a jam
signal to notify other stations of collision.
After sending the jam signal, back off for a random amount of time, then start to
transmit again.
CSMA/CD, as well as many other LAN protocols, uses the conceptual model of Fig.
6. At the point marked t0, a station has finished transmitting its frame. Any other station
having a frame to send may now attempt to do so. If two or more stations decide to
transmit simultaneously, there will be a collision. Collisions can be detected by looking at
the power or pulse width of the received signal and comparing it to the transmitted signal.
After a station detects a collision, it aborts its transmission, waits a random period
of time, and then tries again, assuming that no other station has started transmitting in the
14
meantime. Therefore, our model for CSMA/CD will consist of alternating contention and
transmission periods, with idle periods occurring when all stations are quiet (e.g., for lack
of work).
It is important to realize that collision detection is an analog process. The station's
hardware must listen to the cable while it is transmitting. If what it reads back is different
from what it is putting out, it knows that a collision is occurring. The implication is that
the signal encoding must allow collisions to be detected (e.g., a collision of two 0-volt
signals may well be impossible to detect). For this reason, special encoding is commonly
used.
CSMA/CD with a single channel is inherently a half-duplex system. It is
impossible for a station to transmit and receive frames at the same time because the
receiving logic is in use, looking for collisions during every transmission.
To avoid any misunderstanding, it is worth noting that no MAC-sublayer protocol
guarantees reliable delivery. Even in the absence of collisions, the receiver may not have
copied the frame correctly for various reasons (e.g., lack of buffer space or a missed
interrupt).
IEEE 802.3 standards for LAN
15