10 - MAC Layer 1
10 - MAC Layer 1
Sublayer
Sachin Gajjar
sachin.gajjar@nirmauni.ac.in
Reading Material for this topic
• Computer Networks, Fourth Edition by
Andrew S Tanenbaum
– Chapter 4, Topic 4.1, 4.2.1, 4.2.2, 4.2.6
2
Network categories:
1. Those using point-to-point channels
2. Those using broadcast channels
• In broadcast network, key issue is to determine who
gets to use channel when there is competition for it.
• Broadcast channels = multiaccess channels
• Eg. conference call – chaos in who goes next
• Eg. Face to face meeting – raise hands when you want
to speak
• protocols used to determine who goes next on a
multiaccess channel belong to a sublayer of data link
layer called MAC (Medium Access Control) sublayer
Static Channel Allocation in LANs and MANs
• Static channel – FDM
• N users BW divided into N equal size portion
• All users may not access channel – a waste
• More than N users want to communicate some
may be denied due to lack of BW
• OK for small fixed no. users with heavy load
• When users more and traffic bursty – not ok
• computer systems peak : mean traffic = 1000:1
• Channel idle for most of time
• Same for TDM – user may not use allotted time
Dynamic Channel Allocation in LANs and MANs
• Key assumptions
• Station Model
• Consists of N independent stations, each
generates frames for transmission.
• Once a frame has been generated, station is
blocked and does nothing until the frame has
been successfully transmitted
• Single Channel Assumption
• Single channel is available for all communication
• All stations can transmit on it and all can receive
from it.
• Hardware at all stations are equivalent,
• Protocol software may assign priorities to them.
• Collision Assumption.
• If 2 frames are transmitted simultaneously, they
overlap in time and 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.
• Carrier = electrical signal on cable
• Continuous Time. Frame transmission can begin at any
instant. No master clock dividing time into discrete
intervals.
• Slotted Time. Time is divided into discrete intervals
(slots). Frame transmissions always begin at 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.
• Carrier Sense. Stations can tell if channel is in use before
trying to use it. If channel is sensed as busy, no station
will attempt to use it until it goes idle.
• No Carrier Sense. Stations cannot sense channel before
trying to use it. They just go ahead and transmit. Only
later can they determine whether transmission was
successful.
Multiple Access Protocols
• ALOHA
• In 1970s, Norman Abramson, University of
Hawaii devised method to solve channel
allocation problem.
• Work used ground-based radio broadcasting
• Basic idea is applicable to any system in which
uncoordinated users are competing for use of
a single shared channel.
• Two versions of ALOHA here: pure and slotted.
Pure ALOHA
• Let users transmit whenever they have data to be sent.
• There will be collisions, colliding frames will be damaged.
• Due to feedback property of broadcasting, sender can
always find out whether its frame was destroyed by
listening to channel
• If listening while transmitting is not possible for some
reason, acknowledgements are needed.
• If frame was destroyed, sender just waits a random
amount of time and sends it again.
• Waiting time must be random or same frames will collide
over and over, in lockstep.
Frame generation in an ALOHA system
• Frames of same length
Efficiency of an ALOHA channel
• Frame time = amount of time needed to transmit
standard, fixed-length frame
• Frame time = Frame length/bit rate
• Infinite number of users generates new frames
according to Poisson’s distribution with average N
frames per frame time
• If N > 1, users generating frames at a higher rate
than channel can handle and most frames will
suffer a collision
• To reduce collision we would expect 0 < N < 1
• In addition to new frames, stations also generate retransmissions
of frames that previously suffered collisions.
• Let there be k transmission attempts (including retransmissions)
per frame time.
• The probability of k transmissions per frame time is also
Poisson.
• Let the mean of these transmissions be G per frame time.
• Clearly, G ≥N (old (duplicate) and new frames will be more than
new frames)
• At low load (N≈0), few collisions, few retransmissions, so G ≈ N.
• At high load there will be many collisions, so G > N
• For all loads, Throughput per frame time = S = G x Probability
that a frame doesn't suffer collision = GP0
• We find P0
Vulnerable time for the shaded frame
• e = constant=2.71828
• We get efficiency of 18 percent in Pure Aloha
Example
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 = frame length/bit rate
= 200 bits/200 kbps = 1 ms.
Vulnerable time = 2t = 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 one 1-ms period that this station is
sending.
Example
A pure ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the throughput in
terms of number of frames/percentage if system (all
stations together) produces
a. 1000 frames per second b. 500 frames per second
c. 250 frames per second.
Solution
The frame transmission time = 200 (frame length)/200 kbps (bit
rate)=1 ms.
a. If system creates 1000 frames per second, this is 1
frame per millisecond. The load offered by system i.e G
is 1. Thus S = G× e−2 G or S = 1 × e−2*1 = 1/(2.71828)2=0.135
(13.5 percent). From 100 frames 13.5 will not collide, how many
from 1000 frames will be successfully transmitted without collision.
Throughput = 1000 × 13.5/100 = 135 frames. Only 135 frames out
of 1000 will probably survive.
Example 12.3 (continued)
b. If 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.
t0 t0 + t t0+2 t
=t
• If interval is one frame time long (t, vulnerable
period), mean number of frames generated
will be G (transmission attempts)
• Probability of generating zero frames i.e. k= 0
during t (when 0 frame generated no collision
and so no frame damaged)
• P0=[(G)0 e -G]/0!
• P0 = e -G
• Using S = GP0,
• S=G e -G
offered traffic (G) and throughput (S)
Slotted ALOHA
• maximum throughput (S) occurs at G = 1,
S=G e -G
S=1/e-1
• e = constant=2.71828
S = 1/2.71828 = 0.3678
• We get efficiency of 37 percent in Slotted
Aloha, twice that of pure ALOHA.
Carrier Sense Multiple Access Protocols
• In LAN, it is possible for stations to detect
what other stations are doing, and adapt their
behavior accordingly.
• Protocols in which stations listen for a carrier
(i.e., a transmission) and act accordingly are
called carrier sense protocols.
• CSMA is based on the principle "sense before
transmit" or "listen before talk”
Persistence Methods
longer propagation delay, more important this effect becomes, and worse is the
performance of the protocol
nonpersistent CSMA
• attempt is made to be less greedy
• Before sending, a station senses the channel.
• If no one else is sending, the station begins doing so itself.
• However, if channel is already in use, station does not continually
sense it for purpose of seizing it immediately upon detecting end of
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
p-persistent CSMA
• Used if channel has time slots with a slot duration ≥
maximum propagation time
• When a station becomes ready to send, it senses the
channel.
• If station finds channel idle it follows these steps:
Power level
Minimum Frame Size
• If two stations involved in a collision are maximum distance apart,
signal from first takes time Tp (propagation time) to reach second
• Effect of collision takes another time Tp to reach the first
• So requirement is that first station must still be transmitting after
2Tp (i.e. active to know collision has occurred)
Tp (Message)
Tp (Collision)
Example
A network using CSMA/CD has a bandwidth of 10 Mbps.
If maximum propagation time (including the delays in the
devices) is 25.6 μs, what is minimum size of frame?
Solution
• The frame transmission time is Tfr = 2 × Tp = 51.2
μs.
• This means, in worst case, a station needs to
transmit for a period of 51.2 μs to detect collision.
• Transmission time=Message size/BW
• Minimum size of frame = 10 Mbps × 51.2 μs = 512
bits or 64 bytes
• This is frame size of Ethernet
CSMA/CD
procedure
Thank You!