You are on page 1of 20

Medium Access Control: Part 3

Gaurav S. Kasbekar
Dept. of Electrical Engineering
IIT Bombay

1-1
Reference
 These are a modified version of slides by
Kurose and Ross available at:
http://ctas.poly.asu.edu/millard/CET459/lectno/K%
20-%20R%20stuff/index.html

1-2
Example 1
 𝑁 nodes use Slotted ALOHA; each always has a
packet to send
 Attempt probability: 𝑝
 Want average number of slots required for
successful transmission of a fixed node 𝑖’s packet
 Probability of successful transmission by node
𝑖 in a given slot:
 𝑝(1 − 𝑝)𝑁−1
 Average number of slots required for successful
transmission:
1

𝑝(1−𝑝)𝑁−1
5-3
Example 2
 Above scenario with following changes
 Nodes 1, … , 𝐾 have delay-sensitive traffic (e.g., voice)
 attempt probability 𝑝1
 Nodes 𝐾 + 1, … , 𝑁 have elastic traffic (e.g., file
transfer)
 attempt probability 𝑝2 < 𝑝1
 Want average number of slots required for successful
transmission of a fixed node 𝑖’s packet
 Case (i): 𝑖 ∈ {1, … , 𝐾}
1

𝑝1 (1−𝑝1 )𝐾−1 (1−𝑝2 )𝑁−𝐾

 Case (ii): 𝑖 ∈ {𝐾 + 1, … , 𝑁}
1

𝑝2 (1−𝑝1 )𝐾 (1−𝑝2 )𝑁−𝐾−1

 Smaller in Case (i) 5-4


Recall: CSMA and CD
 Carrier Sense Multiple Access (CSMA)
 Nodes sense the medium before attempting
transmission
 Don’t transmit if medium found busy

 Collision Detection
 Nodes sense the medium while transmitting packets
 Abort transmission if collision detected
 Reduces time spent in colliding

5-5
Example

5-6
MAC Protocol in Traditional
Ethernet
 Both CSMA and Collision Detection used
 MAC Protocol called “CSMA/ CD”

5-7
Ethernet CSMA/CD Algorithm
When node gets new packet: 3. If node detects another
1. It senses channel. If transmission while
channel idle, node starts transmitting, aborts
to transmit packet. If transmission.
channel busy, waits until 4. After aborting, node waits
channel idle and then for a random amount of
transmits. time and returns to step 1
2. Node senses channel while
transmitting. If node
transmits entire packet
without detecting another
transmission, it is done
with packet.
5-8
Ethernet CSMA/CD Algorithm
 Notice that a node sends
 a new packet immediately after channel found
idle
 a packet involved in one or more collisions after
waiting for a random amt of time
 Why not send every packet after a random
amount of time?
 To ensure that when only one node has
packets to send, it can get throughput R
 Similar to Slotted ALOHA and ALOHA

5-9
Random Backoff
 In step 4, node waits for a random amount of time
 “random backoff”

 In particular, waits for time K . ts


 where ts is duration of one “slot”
 and K is a random integer selected uniformly from a range
of integers
 What is a good range from which to choose K?
 If number of colliding nodes is large and range is
small, collision likely to occur again
 If number of colliding nodes is small and range is
large
 collision not likely to occur again
 but lot of time wasted in waiting (channel idle) 5-10
Random Backoff
 If the node knew the number of colliding nodes, it could
choose range proportionately
 But node only knows whether a collision occurs or not each
time it attempts transmission
 Intuitively, if current packet collided several times, likely
that lot of other nodes attempting transmission as well
 So choose a larger range in next attempt
Algorithm:
 After first collision: choose K from {0,1}; delay is K· ts
 After second collision: choose K from {0,1,2,3}…
 After 10 or more collisions, choose K from
{0,1,2,3,4,…,1023}
 Called “Binary Exponential Backoff” Algorithm
5-11
Adaptive Backoff
 In above backoff process, node adapts
backoff duration based on number of
collisions experienced
 Recall that in slotted ALOHA, the
probability of successful transmission in a
slot is maximized when p = 1/N
 where N is number of nodes attempting
transmission
 not known in general
 adaptive algorithm similar to binary exponential
backoff can be used to adapt p
 Similar facts hold for Pure ALOHA
5-12
Persistence
 In step 1, if node finds medium busy, it waits
until channel becomes idle and then transmits
immediately with probability 1
 Such an algorithm called 1-Persistent
 Potentially problematic for heavily loaded
networks
 e.g., nodes 1 and 2 wait for node 3’s transmission to
end
 then both transmit resulting in collision

 Alternative: in step 1, if node finds medium


busy, wait for random amt of time and try again
 called “nonpersistent” algorithm
5-13
Persistence
 Ethernet uses a 1-Persistent algorithm
 Reason
 Collision Detection implemented
 So even if collision occurs, detected quickly and
transmission aborted
 Delay until transmission lower than in
nonpersistent algo
 Roughly, performance of 1-Persistent algo
better than nonpersistent algo:
 for light loads,
 when Collision Detection available,

and vice versa 5-14


Preventing Undetected Collisions

 𝐴 starts sending a small pkt to 𝐵 at 𝑡 = 0


 𝐶 starts sending a pkt at 𝑡 = 𝜖
 𝐴′ 𝑠 pkt collides at 𝐵
 Collision not detected by 𝐴
 To prevent such situations:
 lower limit imposed on pkt length

5-15
Minimum Packet Length
 Minimum length of an Ethernet packet is
number of bits that can be transmitted in a
slot duration
 R . ts
 if packet is smaller than this, padded with
dummy bits
 With appropriate choice of ts, this
prevents a node from completely
transmitting a small packet before it
detects collision

5-16
Slot Duration
 ts is chosen such that if a node starts transmitting and a
collision occurs, then it always detects collision by end of
the slot
 What is the min. value of ts that ensures this?
 2 τ, where τ is max. prop. delay between any two nodes

Ref: Tanenbaum, Chapter 4


Summary: Preventing
Undetected Collisions

 Packet length must be at least R . ts


 ts chosen to be slightly greater than 2 τ,
where τ is max. prop. delay between any
two nodes

5-18
Example: 10 Mbps Ethernet
 Max. length of single cable 500 m
 Multiple cables can be combined using repeaters
 At most 4 repeaters on cable
 So total cable length 2500 m
 τ = prop. time for 2500 m + 4 repeater delays
 2τ found to be approx. 50 microseconds
 Slot duration ts : 51.2 microseconds
 Min packet length:
 512 bits (64 bytes)

5-19
Example: 10 Mbps Ethernet (contd.)

Collisions may go undetected if:


 cable length and/or number of repeaters
increased beyond above limits or
 packets smaller than 64 bytes sent

5-20

You might also like