Вы находитесь на странице: 1из 114

IT 605

Computer Networks

MAC Layer and Local Area Networks

Prof . Anirudha Sahoo


KReSIT
IIT Bombay

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.1


MAC Layer
• Sub layer in Data link layer
– Responsible for providing access to
the medium
– Protocol defines how packets from
multiple nodes can be sent on the
medium

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.2


Network Layer

LLC 802.2 Logical Link Control

802.3 802.5 802.11 Other


MAC CSMA-CD Token Ring Wireless LANs
LAN

Physical Various Physical Layers


Layer

IEEE 802
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.3
Static Channel Allocation
Problem 3
• Access Model: 2 4
– Can be modeled as 1
n independent
nodes, each Shared Multiple
wanting to Access Medium
communicate with
another node and M 5
they have no other
form of
Channel Allocation Problem
communication.
To manage a single broadcast channel which must be shared
among n uncoordinated users in the following manner
• efficiently i.e. maximize message throughput and
• fairly and,
• minimize mean waiting time
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.4
Multiple Access Problem

• Ring networks

• Multitapped Bus

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.5


Multiple Access Problem

Satellite = fin
Channel
= fout

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.6


Possible Assumptions for
Channel Allocation Problem
0. Listen property :: (applies to satellites)
The sender is able to listen to sent
frame one round-trip after sending it.
 no need for explicit ACKs

1. Model consists of n independent


stations.

2.ProfA. Anirudha
single channel is available
sahoo, KReSIT, IIT Bombay MAC Layer
for 3.7
Possible Model Assumptions
for
Channel
3. Allocation
Collision Assumption :: If Problem
two frames
are transmitted simultaneously, they
overlap in time and the resulting
signal is garbled. This event is a
collision.

4a. Continuous Time Assumption ::


frame transmissions can begin at
any time instant.

4b. Slotted Time Assumption :: time is


divided into discrete intervals
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer
(slots). 3.8
Possible Model Assumptions
for
Channel Allocation Problem
5a. Carrier Sense Assumption ::
Stations can tell if the channel is busy
(in use) before trying to use it. If the
channel is busy, no station will attempt
to use the channel until it is idle.

5b. No Carrier Sense Assumption ::


Stations are unable to sense channel
before attempting to send a frame.
They just go ahead and
Prof . Anirudha sahoo, KReSIT, IIT Bombay
transmit a
MAC Layer 3.9
Centralized versus
Distributed
• Two fundamental design choice
• Centralized : (GSM, CDMA)
– One station is a master station
– Other stations are slaves
– Master decides when a slave can
send data

• Distributed: (Wireless LAN,Ethernet)


– No master station every other station
is free to talk to any other
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer
station 3.10
Circuit versus Packet mode
• Circuit mode for smooth continuous traffic
(voice)
– Makes sense to allocate part of the link to
to the source for its exclusive use, avoiding
link access protocol repeatedly---> circuit
mode(GSM)

• Packet mode for bursty data traffic


– Fixed allocation of resource may cause
under-utilization
– Compete for link access for each packet
transmission ( GPRS)
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.11
Constraints
Design of multiple access scheme is
highly constrained by
implementation environment
• Spectrum Scarcity
– spectrum is scarce resource
– FCC allows 902-928 Mhz, 2.40-2.48
Ghz for ISM band for 1- 10 mile
with restriction in transmission
power
• Radio link properties
– Fading, multi-path interference,
Prof . Anirudha sahoo, KReSIT, IIT Bombay
MAC Layer 3.12
Constraints
• Performance of ‘packet mode’ multiple
access scheme heavily depends upon
a = D/T
D= maximum propagation delay between any
two stations (in seconds)
T= Time to transmit an average size packets
(seconds)
‘a’ is the number of packets that a station can
put in the medium before the first bit is
received by the receiver. .01 (wired, wireless
LAN, cellular packet radio), 100 satellite

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.13


Constraints
• Impact of ‘a’ on collision recover
scheme:
‘a’ determines what happens when
two senders transmit simultaneously
– With small ‘a’ packet collide soon and senders can know
soon by listening to the medium
– With large ‘a’, collision takes longer time after packet is
transmitted. So only sensing medium is not sufficient to
recover from collision. Some more protocol structure is
required.

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.14


The parameter ‘a’
• The number of packets sent by a
source before the farthest station
receives the first bit

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.15


Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.16
Performance Metrics
• Normalized throughput or Goodput
– Fraction of link capacity devoted to
carrying non-retransmitted packet.
– E.g capacity 1 mbps, packet size 125 bytes,
then it should carry 1000 packets per
second. But due to protocol overhead
carries only 250 packets/sec. Goodput=
.25. Realistic MA schemes --> .1 to .9
• Mean Delay
– Duration a packet has to wait before it gets
transmitted successfully
– Depends on --load, -- MA scheme, --
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.17
media characteristic
Contd..
• Stability
– When offered load is low medium/ MA scheme can carry the
load
– When load increases, collision increases and systen throughput
tend to decrease. Almost every transmission is a collision.
– Stable system --> Throughput does not decrease when load
increases beyond certain threshold
– Proper MA scheme can achieve this by dynamically decreasing
the load when overload is detected
– if infinite number of uncontrolled stations share a link, then
instability is guaranteed
– but if sources reduce load when overload is detected, can
achieve stability
• Fairness
– No starvation
– Equal share of bandwidth.
– max-min fair share: will study later
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.18
Carrier Sense Multiple
Access
• Listen before you speak
• Check whether the medium is active
before sending a packet (i.e carrier
sensing)
• If medium idle, then transmit
• If collision happens, then detect and
resolve

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.19


CSMA: Distributed, Packet
mode scheme
• Carrier Sense and its variants:
– Use of carrier sensing capability to
know if someone else is using the
medium
– 1 persistent
• If medium busy, keep sensing
• If medium Idle send immediately
– p persistent
• If medium busy, keep sensing
• If medium Idle,
– send with probability p,
– in case of no-send (1-p), wait for 1 time slot, and
begin medium sensing again
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.20
CSMA
– Non persistent
• If medium busy, wait for random time
before sensing again
• If medium Idle send immediately

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.21


Choice of p in p-persistent
system
• Time slot is usually set to twice the
maximum propagation delay (2 * RTT)
• np = mean number of stations that will
send packets in a slot
• as p decreases,
– stations wait longer to transmit, but
– the number of collisions decreases
• if np > 1: collision likely
• So p < 1/n
• Large n needs small p which causes delay

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.22


Collision detection
(CSMA/CD)
• All aforementioned scheme can
suffer from collision
• Device can detect collision
– Listen while transmitting
– Wait for 2 * propagation delay

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.23


How to avoid/recover
collision
• 1 persistent and non persistent results in
guaranteed collisions when two node
decided to transmit simultaneously
• Rescue: p persistence or Exponential Back
off
• P persistent:
– p= .5, .1, .8 reduces the chance of
collision
– Choice of p:
• Trade-off between performance under heavy
load and mean packet delay
• Under heavy load mean number of stations
that will send packet is np, if np > 1 then
collision is likely. Therefore
Prof . Anirudha sahoo, KReSIT, IIT Bombay
choose p < 1/n3.24
MAC Layer
( dynamic adjustment??)
Contd..
• Advantages:
– Dynamically adjusts p, no need to
choose p optimally.
– In high load, backs -off drastically,
and reduces load on network to give
stable throughput

• Disadvantages
– Delay increases
– ?? Fairness??
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.25
Exponential backoff
• On detecting 1st collision for
packet x
station A chooses a number r
between 0 and 1.
waits for r * slot time and
transmit.
Slot time is 2 * propagation delay
On detecting kth collision for packet
x
choose r between 0,1,..,(2k –1)
• When value of k becomes high
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.26
CSMA/ CD
(802.3,Ethernet)Performan
ceEthernet's
• understanding the
distributed contention scheme, under
high load
• transmission interval:
– is that during which the Ether has
been acquired for a successful packet
transmission.
• contention interval:
– is that composed of the
retransmission slots
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.27
• Idle interval
CSMA contention
• Station A transmits.
interval Just before its
signal reaches B, station B senses
channel is idle and starts
transmitting resulting in collision
• The longer the propagation delay,
the worse the performance of the
protocol

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.28


Contention Interval - 2D
A B
t = 0: A begins transmission

t = D - ε : packet almost at B A B
B begins transmission

A B
t = D: B detects collision,
stops transmitting

A B
t = 2D - ε : A detects collision

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.29


CSMA/ CD
(802.3,Ethernet)Performan
ce
Metcalfe and Boggs approach:
Try to find mean duration of contention
interval
Or
mean number of contention slots in a
contention interval
• k node is contending in contention period
• Assume each node transmits with a fixed
probability p in any slot
• What is the probability (‘A’) that some
station acquires the channel in a slot (for
successful transmission)?
– A= p(1-p)^k-1 + p(1-p)^k-1
Prof . Anirudha sahoo, KReSIT, IIT Bombay
MAC Layer
+… k times 3.30
Contd..
• what is the probability (Pj) that a
contention interval has exactly j slots?
» (i.e after the collision, the least size of back off interval
chosen by some node is j slots or, what is the probability
that some station transmits only at j th slot and not in
previous j-1 no slots?)

– p(Not transmitted in 1 st slot)= ( 1-A)


– p(Not transmitted in 1 st slot and 2nd slot)= ( 1-A)(1-A)
Pj= A(1-A) ^j-1 -----(1)
Over a long period of time, the mean number of
slots per contention interval is given by
Sumj=0j=inf (j* A(1-A)j-1 ) = 1/A (=
mean of geometric distribution given in (1) )

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.31


Contd…
• Since each slot is 2*Tprop,
– Mean length of contention interval is
Tcontention = 2* Tprop /A
• Now if Ttrans is time needed for transmitting
mean packet size then
Channel efficiency (w) is =
time required to transmit in
absence of collision/ time required to
transmit in presence of collision
w= Ttrans / (Ttrans + 2* Tprop /A)
• So longer the propagation time Tprop(
cable length!), the longer the contention
Profinterval.
. Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.32
Example: Ethernet (IEEE
802.3)
• CSMA/CD with jamming
• Ethernet Address (48 bits)
– Example: 08:00:0D:01:74:71
• Ethernet Frame Format
– SFD : Start of frame delimiter (1 bit)
– FCS : Frame Check Sequence (checksum)
– L : length of the Data field

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.33


Minimum frame size
A B
t = 0: A begins transmission

A B
t = D - ε : packet almost at B
B begins transmission

A B
t = 1: B detects collision,
stops transmitting

A B
t = 2D - ε : A detects collision

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.34


Minimum frame size
• It takes A a complete RTT (2D) to
detect collision
• When B detects collision (gets more
power than it is putting out) it
generates 48-bit noise burst (“Jam”
bits) to warn all other stations
• Min. frame size equal to number of
bits transmitted during one RTT

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.35


Minimum frame size
• slotTime: number of bits
transmitted by a source during the
max. RTT (2D = 51.2 µsec) for any
Ethernet network
• Collisions must be detected by
sources while still transmitting
• All frames must be at least 1 slot
(on 10Mbps, this is 512 bits)

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.36


Ethernet
• The most widely used LAN
• Standard is called IEEE 802.3
• Uses CSMA/CD with exponential backoff
• Also, on collision, place a jam signal on
wire, so that all stations are aware of
collision and can increment timeout
range
• ‘a’ small =>time wasted in collision is
around 50 microseconds

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.37


Ethernet
• Ethernet requires packet to be long
enough that a collision is detected
before packet transmission
completes (a <= 1)
– packet should be at least 64 bytes
long for longest allowed segment
• Max packet size is 1500 bytes
– prevents hogging by a single station

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.38


More on Ethernet
• Ethernet types are coded as
<Speed><Baseband or
broadband><physical medium>
– Speed = 3, 10, 100 Mbps
– Physical medium:
• “2” is cheap 50 Ohm cable, upto 200
meters
• “T” is unshielded twisted pair (also

used for telephone wiring)


• “36” is 75 Ohm cable TV cable, upto

3600 meters
• 10base5: 500m segment, 100MAC
node, Original, bus
Prof . Anirudha sahoo, KReSIT, IIT Bombay
Layer 3.39
topology
Recent developments
• Switched Ethernet
– each station is connected to switch
by a separate UTP wire
– line card of switch has a buffer to
hold incoming packets
– fast backplane switches packet from
one line card to others
– simultaneously arriving packets do
not collide (until buffers overflow)
– higher intrinsic capacity than
10BaseT (and more expensive)
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.40
Fast Ethernet variants
• Fast Ethernet (IEEE 802.3u)
– same as 10BaseT, except that line
speed is 100 Mbps
– spans only 205 m
– big winner
– most current cards support both 10
and 100 Mbps cards (10/100 cards)
for about $80 ( Old data, probably
cheaper now)

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.41


Fast Ethernet variants
• 100VG Anylan (IEEE 802.12)
– station makes explicit service
requests to master
– master schedules requests,
eliminating collisions
– not a success in the market
• Gigabit Ethernet
– aims to continue the trend

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.42


Gigabit Ether Switch

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.43


KReSIT internet connection

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.44


Evaluating Ethernet
• Pros
– easy to setup
– requires no configuration
– robust to noise
• Problems
– at heavy loads, users see large
delays because of backoff
– nondeterministic service
– doesn’t support priorities
– big overhead on small packets
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.45
Evaluating Ethernet
• But, very successful because
– problems only at high load
– can segment LANs to reduce load

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.46


Centralized access schemes
• One station is master, and the other are
slaves
– slave can transmit only when master
allows
• Natural fit in some situations
– wireless LAN (Point coordination function
mode, PCF), where base station is the
only station that can see everyone
– cellular telephony, where base station is
the only one capable of high transmit
power
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.47
Centralized access schemes
• Pros
– simple
– master provides single point of
coordination
• Cons
– master is a single point of failure
• need a re-election protocol
• master is involved in every single

transfer => added delay

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.48


Polling
• Centralized packet-mode multiple
access schemes
• Polling (PCF mode of wireless LAN )
– master asks each station in turn if it
wants to send (roll-call polling)
– inefficient if only a few stations are
active, overhead for polling messages
is high, or system has many terminals

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.49


Reservation-based schemes
• When ‘a’ is large, can’t use a
distributed scheme for packet mode
(too many collisions and waste of
bandwidth)
– mainly for satellite links
• Instead master coordinates access to
link using reservations
• Some time slots devoted to
reservation messages
– can be smaller than data slots =>
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.50
minislots
Reservation-based schemes
• Stations contend for a minislot (or
own one)
• Master decides winners and grants
them access to link
• Packet collisions are only for
minislots, so overhead on contention
is reduced

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.51


Reservation Based: Basic Bit-Map
Protocol
(Collision-Free Protocols)
N=8

• N stations with addresses 0 to N-1


• N one-bit contention slots.
• If a station i has a frame to send, it
sends a one during contention slot i.
• Once all stations indicated frame
availability, ready frames are
transmitted in address order.
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.52
Bit-Map Protocol
• Representative of reservation
protocols (where each station
broadcasts its desire to transmit
before actual transmission).
• Efficiency per frame:
– With low load = d/(N + d) With
high load = d/(1 + d)
d = number of bits in one
frame
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.53
Bit Map Protocol

Issues
• Stations' access to the network is
unfair: That is, if station i and station
j both want to transmit, and i < j,
then station i always first to transmit.
• low numbered stations have to wait
longer than high numbered stations
for the reservation to complete.
•ProfEfficiency: at low load, MAC
. Anirudha sahoo, KReSIT, IIT Bombay
theLayer
protocol 3.54
efficiency is low.
Limited Contention
Protocol
• None of full reservation and full
contention mechanisms are not suitable
for extreme condition of load.
• Reservation scheme is appropriate for
high load situation, contention for low
load situation
• A mix of reservation and contention may
be an adaptive and optimal approach

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.55


Limited Contention Protocol
• We have seen that probability of
successful transmission by some
node ( among n contending nodes) is
maximized when p <1/n. Decreases
drastically with increase of n
• Heavily dependent on n or size of
contention domain
• Protocol which can make smaller
subgroup of nodes ( and thus limiting
the contention) and then give
chance to each group-- Splitting
ProfAlgorithms
. Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.56
Limited contention - Adaptive Tree
Walk
• Combines best properties of contention and
collision free protocols.
• Divides stations into groups.
• In first contention slot, everyone is allowed to
compete.
• If collision, then only those1 in group 1 are allowed
to compete, and so on down the hierarchy.
2 3

4 5 6 7

A B C D E F G H

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.57


Decentralized polling
• Just like centralized polling, except
there is no master
• Each station is assigned a slot that it
uses
– if nothing to send, slot is wasted
• Also, all stations must share a time
base

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.58


Token passing
• In distributed polling, every station
has to wait for its turn
• Time wasted because idle stations
are still given a slot
• What if we can quickly skip past idle
stations?
• This is the key idea of token ring
• Special packet called ‘token’ gives
station the right to transmit data
• When done, it passes token to ‘next’
station
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.59

– => stations form a logical ring


Token Ring operation
• Frames flow in one direction: upstream to
downstream
• special bit pattern (token) rotates around
ring
– The ring should be able to hold the token
– IEEE 802.5---> 1 bit holding buffer
• must capture token before transmitting
• During normal operation, copy packets
( token and data) from input buffer to
output

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.60


Token Ring operation
• If packet is a token, check if data packets
ready to send
• If not, forward token
• If so, delete token, and send packets
• Receiver copies packet and sets ‘ack’ flag
• Sender removes packet and deletes it
• When done, reinserts token
• If ring idle and no token for a long time,
regenerate token

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.61


Logical rings
• Can be on a non-ring physical
topology

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.62


Ethernet vs. Token Ring:
• Open Ethernet
standard Dominance
• Proprietary
platforms
“forced” to
support
standards or
FDDI Market $220M
1997, $40M 2001.
lose value
Fast Ethernet
$150/port
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.63
FDDI $750/port
Various Token ring
networks
• Token Ring Networks
– PRONET: 10Mbps and 80 Mbps rings
– IBM: 4Mbps token ring
– 16Mbps IEEE 802.5/token ring
– 100Mbps Fiber Distributed Data
Interface (FDDI)

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.64


Evaluating token ring
• Token Holding Time (THT)
– 10 msec upper bound (ieee 802.5)
– Token Rotation Time <= ActiveNodes *
THT + Ring Latency (RL)
• RL significantly large for MANs
• Pros
– medium access protocol is simple and
explicit
– no need for carrier sensing, time
synchronization or complex protocols to
resolve contention
– guarantees zero collisions
– can give some stations priority over others
( see later)
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.65
– At high loads can effectively become TDM
Evaluating token ring
• Cons
– token is a single point of failure
• lost or corrupted token trashes
network
• need to carefully protect and, if

necessary, regenerate token


– all stations must cooperate
• network must detect and cut off
unresponsive stations
– stations must actively monitor
network ( see next slide)
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.66
• usually elect one station as monitor
Token Ring Maintenance
• Need for a monitor ( increased complexity)
– Token may be lost, corrupted
– Data frame may be orphaned
• Monitor sends periodic beacon
• Monitor election
– In absence of beacon, any node transmits
‘claim token’ control packet. The node
which can do it first, and seen by
everybody, becomes the monitor.
• Lost Token:
– Monitor waits for TimeOut = NoOfStations
* THT + RL
– If no token, insert token
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.67
Token Ring Maintenance
• Garbled frame
– Check for checksum, and remove
• Orphan frame
– Delete from the ring
– Use of monitor bit ( if set and seen
twice by Monitor, delete it)

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.68


Priority Operation in Token
Ring
• Used for time critical application
– Provides a mechanism that higher priority
frames across the nodes will be transmitted
first
– Same priority frames will have same access
right to the ring
– Priorities are for traffic classes.
– Token Contains 3 bit priority field. 6 priority
level possible

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.69


Priority Operation in Token
• Operation:
Ring
– Token has a certain priority n initially
– If received packet is token (with priority ‘n’):
• A node X, having a packet with priority p, seizes the
token if p>= n
– transmits data and, and passes token with its previous
priority value n
• Else passes on the token
– In case received packet is a data and p1 >= p (‘p’ is the
priority carried in the data packet)
• Set priority p1 in reservation bit
• Token holder S, when releasing the token,
– sets this p1 ( received in data frame) in the token ( this
ensures that low priority nodes will not be able to seize
the token)
– Remembers the old value of token priority (‘n’).

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.70


Priority ( contd..)
• The node which raised the priority
value in the token is responsible for
lowering the value
– This is done when S, sees the token
coming back with a higher than/same
value as P1 , indicating all higher
priority packets are serviced, changes
the token priority to ‘n’
• Eventually lowest priority packets
get serviced.
• May be extended delay, due to high
load of higher priority pakets
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.71
Single and double rings
• With a single ring, a single failure of
a link or station breaks the network
=> fragile
• With a double ring, on a failure, go
into wrap mode
• Used in FDDI

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.72


Hub or star-ring
• Simplifies wiring
• Active hub is predecessor and
successor to every station
– can monitor ring for station and link
failures
• Passive hub only serves as wiring
concentrator
– but provides a single test point
• Because of these benefits, hubs are
practically the only form
Prof . Anirudha sahoo, KReSIT, IIT Bombay
of wiring 3.73
MAC Layer
used in real networks
Fiber Distributed Data
Interface
• FDDI is the most popular token-ring base LAN
• Dual counter-rotating rings, each at 100 Mbps
• Uses both copper and fiber links
• Supports both non-realtime and realtime traffic

– token is guaranteed to rotate once every


Target Token Rotation Time (TTRT) ( see later)
– station is guaranteed a synchronous allocation
within every TTRT
• Supports both single attached and dual attached
stations
– single attached (cheaper) stations are
connected to only one of the
Prof . Anirudha sahoo, KReSIT, IIT Bombay
rings
MAC Layer 3.74
Physical Properties of
FDDI
Dual Ring Configuration

(a) (b)

Single and Dual Attachment Stations


Downstream Upstream
Neighbor SAS Neighbor

Concentrato
r (DAS)

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.75


SAS SAS SAS SAS
Characteristics
• Each station imposes a delay (e.g.,
50ns)
• Maximum of 500 stations
• Upper limit of 100km (200km of
fiber)
• Can be implemented over copper
(CDDI)
• FDDI uses 4b/5b NRZI (Non-Return
to Zero Invert on ones) with 100
Mb/s
Prof . Anirudha data
sahoo, KReSIT, rate
IIT Bombay MAC Layer 3.76
Timed Token Protocol
• Target Token Rotation Time (TTRT): agreed-upon
upper bound on TRT.
• There are 2 types of traffic for FDDI:
– Asynchronous transmission
• Given lower priority
– Synchronous transmission
• is given higher priority, needs upper bound
on delay.
• Sum of all symmetric data transmission time <
TTRT
• Token Rotation Time (TRT): how long it takes the
token to traverse the ring.
TRT
Prof . Anirudha <=
sahoo, ActiveNodes
KReSIT, IIT Bombay x THT
MAC+ RingLatency 3.77
Layer
Algorithm
• each node measures TRT between
successive arrivals of the token
• if measured TRT >= TTRT, then token is
late so don't send non-real time
( asynchronous ) data
• if measured TRT < TTRT, then token is
early so OK to send data
• Always send synchronous data, which has
fixed size.
– Total amount of synchronous data by all
nodes <= TTRT
• define two classes of traffic
– synchronous
Prof . Anirudha data: can always
sahoo, KReSIT, IIT Bombay MAC Layer send. Has3.78
Example
• TRT =100 ms ( I.e. since last time the
node has seen the token), TTRT =200
ms.
• Suppose node X has 20 ms
synchronous data.
• There for it can send non real time data
for 200 - 120 ms.
• If it consumes 80 ms, then next node
do not have any time to send
asynchronous data.
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.79
Token Maintenance
• Lost Token
– no token when initializing ring
– bit error corrupts token pattern
– node holding token crashes

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.80


Token Maintenance
• Generating a Token (and agreeing on TTRT)
– execute when join ring or suspect a failure
– each node sends a special claim frame that
includes the node's bid for the TTRT
– when receive claim frame
• If TTRT bid is less than its own
– Set its local TTRT to this values
• If TTRT bid is more than its own
– Remove the claim frame and put its own claim frame into the
ring
– if your claim frame makes it all the way
around the ring:
• your bid was the lowest
• everyone knows TTRT
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.81
• you insert new token
Token Maintenance
• Monitoring for a Valid Token
– should see valid transmission (frame
or token) periodically
– maximum gap = ring latency + full
frame <= 2.5ms
– set timer at 2.5ms and send claim
frame if it times out

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.82


Ethernet vs. Token Ring:
Media Access Control
• Contention Methods
(Ethernet)
– performs better than token passing on
low utilization LANs
– high utilization - collisions and
retransmission when 2 stations try to
communicate simultaneously
• Token passing
– high utilization - superior performance,
no collisions
– QoS – multimedia preference to some
applications
– used to control bus in USB, Firewire, and
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.83
other emerging shared media
Ethernet vs. Token Ring:

Response Time vs. Load

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.84


ALOHA (“free for all”)

• Stations transmit whenever they have data to


send

• Detect Collision or Wait for an acknowledgment

• If no acknowledgment (or collision), try again after a


random waiting time

Collision: If more than one node transmit at the same time


If there is a collision, all nodes have to re-transmit packets

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.85


Vulnerable Window
For a given frame, the time when no other frame may
be transmitted if a collision is to be avoided.
• Assume all frames have same length (L) and require
Tp seconds for transmission
• Each packet vulnerable to collisions for time Vp = ??
– Suppose packet A sent at time to
– If pkt B sent any time between to – Tp and to  end
of packet B collides with beginning of packet A
– If pkt C sent any time between to and to + Tp 
start of packet C will collide with end of packet A
– Total vulnerable interval for packet APacket
Packet
is 2Tp
B T Tp C
p
Packet
t
A
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.86
Throughput of Pure ALOHA
• Based on several assumptions:
1. Traffic Model: transmission attempts follows a
Poisson distribution
2. Fixed packet size
• Poisson Distribution:
Pr[i customers arrive in time interval ‘t’] =
P[n(t) =i] = ((λt) i e -λt )/i!
Where λ = Average arrival rate ( no. of arrival per unit
time)
Assume, G = Average number of transmissions in time
interval Tp= λTp,
– Probability of i transmission attempts per frame
time is poisson with mean G per frame time
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.87
• Probability that i frames are generated during
ALOHA Throughput
• Let S = number of successful packet
transmissions per frame time (equals channel
utilization)

• G (=λΤp in previous expression )= average


number of attempted transmissions per
packet time(user
load+retransmissions).Then,with Poisson
distribution traffic model
• Probability that i frames are generated
during time interval 2Tp (vulnerable window) is
P[n(2Tp) =i] = ((2G) i e –2G )/i!
(In
Prof an sahoo,
. Anirudha interval two
KReSIT, IIT Bombayframe times
MAC Layerlong, the mean
3.88
ALOHA Throughput
• Now Throughput (S) is = offered
load G * Prob that no frame suffers
collision
S= G * Pr( that there is no
transmission in 2Tp time interval
i.e Pr(
n(2Tp)=0 ) )
Pr( n(2Tp)=0 )= e - 2G

•Prof . Anirudha
S=sahoo,G* e - 2G
KReSIT, IIT Bombay MAC Layer 3.89
ALOHA and Slotted ALOHA
Throughput versus Load
0.4

0.35

0.3 0.368
0.25

0.2

0.15
Ge-G
S 0.184
0.1

0.05

0
Ge-2G
0.01563

0.03125

0.0625

0.125

0.25

0.5

8
Peaks at G=.5 ---> max(Throughput) = 1/2e ~ 0.18
• ALOHA can achieve maximum
throughput of 18.4%
dS/dG = e-2G – 2Ge-2G = 0
Gmax = 1/2  Smax = 1/(2e) = 0.184

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.90


Slotted ALOHA
• Time is divided into slots (i.e., slot = one
packet transmission time at least)
• Master station generates synchronization
pulses for time-slots. (e.g., use “pip” from a
satellite)
• Station waits till beginning of slot to send
packet.
• Stations transmit ONLY at the beginning
of a time slot
• Collisions will occur because more than one
frame can send in the slot n
• But collision probability reduces as
Vulnerability Window reduced from 2T to T;

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.91


Slotted ALOHA
• Goodput doubles.
Average no of packet in T (Vulnerable window) time=
P[n(T) =i] = ((G) i e –G )/i!
So S= G * Pr( that there is no transmission in T time interval
i.e Pr( n(T)=0 ) )
Pr( n(T)=0 )= e - G
S= G* e - G

Peaks at G=1
max(Throughput) = 1/e ~ 0.36

dS/dG = e-G – Ge-G = 0


Gmax = 1.0  Smax = 1/e ~ 0.368

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.92


Aloha (contd..)
Observations:
• ALOHA is an unstable protocol
– If G increases to greater than 1 due to
fluctuation in offered load, S will decrease
– Reduction in throughput means fewer
successful packet transmissions and more
collisions
– Number of retransmissions increases,
backlogging messages to be transmitted
and traffic load G
– This in turn decreases S
– Results in operating point moving to right
and S  0
• Random access protocols can be made
stable
Prof using
. Anirudha sahoo, backoff
KReSIT, IIT Bombay parameters
MAC Layer 3.93
Comparison

0.01 persistent CSMA
S (throughput per packet time)

1.0
0.9 0.1­persistent CSMA
0.8
Nonpersistent CSMA
0.7
0.6 0.5­persistent 
0.5 CSMA
0.4
Slotted
ALOHA
0.3 1­persistent
Pure
0.2
CSMA
0.1 ALOHA
0
0 1 2 3 4 5 6 7 8 9

G (attempts per packet time)

• With small p better s but longer delay


Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.94
Difference Between Wired
and Wireless
Ethernet LAN Wireless LAN
B
A B C
A C

• If both A and C sense the channel


to be idle at the same time, they
send at the same time.
• Collision can be detected at
sender in Ethernet.
•ProfHalf-duplex radios in wireless
. Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.95
Hidden Terminal Problem

– A and C cannot
A hear
B each
C other.
– A sends to B, C cannot receive A.
– C wants to send to B, C senses a
“free” medium (CS fails)
– Collision occurs at B.
– A cannot receive the collision (CD
fails).
– A is “hidden” for C.
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.96
Exposed Terminal Problem

A B
D
C

– A starts sending to B.
– C senses carrier, finds medium in
use and has to wait for A->B to
end.
– D is outside the range of A,
therefore waiting is not necessary.
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.97
– A and C are “exposed” terminals
CSMA: Distributed, Packet
mode scheme
• Carrier Sense and its variants:
– Use of carrier sensing capability to
know if someone else is using the
medium
– 1 persistent
• If medium busy, keep sensing
• If medium Idle send immediately

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.98


CSMA: Distributed, Packet
mode scheme
– p persistent
• If medium busy, keep sensing
• If medium becomes Idle after continuous
sensing,
– send with probability p, (wait IFS time for 802.11, then do a
random back-off)
– in case of no-send (1-p), wait for 1 time slot, and begin medium
sensing again
• If medium is free for IFS period, transmit
packet.
– Non persistent
– If medium busy, wait for random time before sensing again
– If medium Idle send immediately

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.99


Summary of CSMA schemes

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.100


802.11 - MAC layer
• Traffic services
– Asynchronous Data Service (mandatory)
– DCF
– Time-Bounded Service (optional) - PCF
• Access methods
– DCF CSMA/CA (mandatory)
• collision avoidance via randomized back-off
mechanism
• ACK packet for acknowledgements (not for
broadcasts)
– DCF w/ RTS/CTS (optional)
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.101
• avoids hidden/exposed terminal problem,
802.11 - CSMA/CA contention window
DIFS DIFS (randomized back-off
mechanism)

medium busy next frame

direct access if t
medium is free ≥ DIFS slot time
– station which has data to send starts
sensing the medium (Carrier Sense)
– if the medium is free for the duration of an
Inter-Frame Space (IFS), the station can
start sending (IFS depends on service
type)
– if the medium is busy, the station has to
wait for a free IFS plus an additional
random back-off time (multiple of slot-
time)
– if another station occupies the medium
during
Prof . Anirudha the back-off
sahoo, KReSIT, IIT Bombay time ofMAC
the station, the
Layer 3.102

back-off timer stops (fairness)


802.11 DCF – basic access
• If medium is free for DIFS time, station
sends data
• receivers acknowledge at once (after
waiting for SIFS) if the packet was
received correctly (CRC)
• automatic
DIFS retransmission of data packets
data
in case of transmission
sender errors
SIFS
ACK
receiver
DIFS
other data
stations t
waiting time contention
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.103
Solution to Hidden/Exposed
Terminals
• A first sends a Request-to-Send
(RTS) to B
• On receiving RTS, B responds Clear-
to-Send (CTS)
• Hidden node C overhears CTS and
keeps quiet
– Transfer duration is included in both
RTS RTS
and CTS RTS
• Exposed
D node
A overhears
CTS
B aCTS
RTS but
C

not the CTS DATA


– D’s transmission cannot interfere at 3.104
Prof . Anirudha sahoo, KReSIT, IIT Bombay
MAC Layer
802.11 - Reliability
• Use acknowledgements
– When B receives DATA from A, B sends
an ACK
– If A fails to receive an ACK, A retransmits
the DATA
– Both C and D remain quiet until ACK (to
prevent collision of ACK)
RTS
– Expected
RTS duration of transmission+ACK
D A B C
is included in RTS/CTS packets
CTS CTS
DATA

ACK
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.105
802.11 –RTS/CTS
• If medium is free for DIFS, station can send RTS with
reservation parameter (reservation determines
amount of time the data packet needs the medium)
• acknowledgement via CTS after SIFS by receiver (if
ready to receive)
• sender can now send data at once,
acknowledgement via ACK
DIFS
• other stations
sender
RTS store medium
data reservations distributed
via RTS and SIFS
CTS SIFS SIFS
CTS ACK
receiver

NAV (RTS) DIFS


other NAV (CTS) data
stations t
defer access contention

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.106


802.11 - Carrier Sensing
• In IEEE 802.11, carrier sensing is
performed
– at the air interface (physical
carrier sensing), and
– at the MAC layer (virtual carrier
sensing)
• Physical carrier sensing
– detects presence of other users by
analyzing all detected packets
– Detects activity in the channel via
relative signal strength from other
sources
• Stations in the BSS use the information 3.107
Prof . Anirudha sahoo, KReSIT, IIT Bombay
MAC Layer
802.11 - Carrier Sensing
• Virtual carrier sensing is done by
sending MPDU duration information
in the header of RTS/CTS and data
frames
• Channel is busy if either
mechanisms indicate it to be
• Duration field indicates the amount
of time (in microseconds) required to
complete frame transmission

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.108


802.11 - Collision
Avoidance
• If medium is not free during
DIFS time..
• Go into Collision Avoidance:
Once channel becomes idle,
wait for DIFS time plus a
randomly chosen backoff time
before attempting to transmit

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.109


802.11 - Collision
Avoidance
• For DCF the backoff is chosen as
follows:
– When first transmitting a packet, choose
a backoff interval in the range [0,cw];
cw is contention window, nominally 31
– Count down the backoff interval when
medium is idle
– Count-down is suspended if medium
becomes busy
– When backoff interval reaches 0,
transmit RTS
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.110
– If collision, then double the cw up to a
Example - backoff

B1 = 25 B1 = 5
wait data

data wait
B2 = 20 B2 = 15 B2 = 10

B1 and B2 are backoff intervals


cw = 31 at nodes 1 and 2

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.111


802.11 - Priorities
• defined through different inter frame
spaces – mandatory idle time intervals
between the transmission of frames
• SIFS (Short Inter Frame Spacing)
– highest priority, for ACK, CTS, polling
response
– SIFSTime and SlotTime are fixed per PHY
layer (10 µs and 20 µs respectively in DSSS)
• PIFS (PCF IFS)
– medium priority, for time-bounded service
using PCF
– PIFSTime = SIFSTime + SlotTime
• DIFS (DCF IFS)
– lowest priority, for asynchronous
Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.112
data service
802.11 - Congestion Control
• Contention window (cw) in DCF:
Congestion control achieved by
dynamically choosing cw
• large cw leads to larger backoff
intervals
• small cw leads to larger number
of collisions

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.113


802.11 - Congestion Control
• Binary Exponential Backoff in DCF:
– When a node fails to receive CTS in
response to its RTS, it increases the
contention window
• cw is doubled (up to a bound cwmax
=1023)
– Upon successful completion data
transfer, restore cw to cwmin=31

Prof . Anirudha sahoo, KReSIT, IIT Bombay MAC Layer 3.114

Вам также может понравиться