Uploaded by satyasaigayathri.pal

Lec19 CSMA MAC Protocol withAudio

advertisement
MEDIUM ACCESS PROTOCOL - CSMA
REF : ANDREW. S. TANENBAUM
“COMPUTER NETWORKS”, 4 TH EDITION
Carrier Sense Multiple Access (CSMA)
 Maximum throughput achievable by ALOHA (slotted) is 0.386.
 In local area networks, however, it is possible for stations to detect what other
stations are doing, and adapt their behavior accordingly. These networks can
achieve a much better utilization than 1/e. This is where Carrier Sensing comes in.
 The nodes sense the medium before transmitting. (i.e, they listen to the medium
to detect if the channel is free.
 This can reduce the vulnerable period.
Carrier Sense Multiple Access (CSMA)
 What do you mean by multiple access ?
 What do you mean by carrier sense ?
 When transmitting, detect if a collision is occurring. If a collision is occurring,
abort as soon as possible and wait a random amount of time before retrying.
 A station cannot sense the entire channel. It can only sense at a point. (eg: as
indicated by the red x mark for station A and the red o mark at station C).
CSMA/CD (contd…)
Carrier Sense Multiple Access (CSMA)
Carrier Sense Multiple Access (CSMA)
Carrier Sense Multiple Access (CSMA)
1-persistent : The nodes senses the channel.
If medium is idle, then transmit.
If medium is not idle, then it continuously checks the channel, waits until it is and then
transmits unconditionally (with probability 1).
Non-persistent: The node senses the channel, if idle it sends the data, otherwise it checks
the medium after a random amount of time (not continuously) and transmits when found
idle.
p-persistent (for slotted channels only) eg: WiFi, Packet radio networks
If medium is idle, then transmit. If medium is not idle, then wait until it is idle.
Once idle then transmit with probability p. And wait for the next slot with probability 1-p
and repeat.
O-persistent : Superiority of nodes is decided beforehand and transmission occurs in that
order. If the medium is idle, node waits for its time slot to send data.
Carrier Sense Multiple Access with Collision
Detection - CSMA/CD
 CSMA/CD can be in one of the states : Contention, Transmission or Idle.
 After beginning transmission, how long until we know that we have control of the channel?
Answer: Twice the propagation delay.
 Suppose 2 stations A and B want to transmit their data. When they sense the channel, they find it free at
the point that they sense. But the data gets collided and corrupted bits are transmitted. How can the stations
know it?
 CSMA/CD doesn’t have ACK.
 CD helps in achieving detection of collisions.
CSMA/CD (contd…)
CASE 1:
A and B can know if there is a collision only if the packet length is very large. So that, when the collision
signal reaches back, A and B would still be transmitting.
CASE 2:
Worst case situation when the collision occurs just before the packet from A reaches B.
Efficiency of CSMA/CD
The CSMA method does not tell us what to do in case there is a collision.
Carrier sense multiple access with collision detection (CSMA/CD) adds on to
the CSMA algorithm to deal with the collision. In CSMA/CD, the size of a frame
must be large enough so that collision can be detected by sender while
sending the frame. So, the frame transmission delay must be at least two times
the maximum propagation delay.
Assume some station transmits a data packet and it successfully gets to the
destination. This is the Best Case, so we have to take the Worst Case scenario in
which there will be contention slots. Contention slots are those slots in which
packets are not successfully transmitted due to collision. The worst case time
wasted is 2Tp.
Efficiency (contd…)
Now we don’t know how many contention slot, so we consider the worst case to be of n contention slots.
Efficiency (contd…)
INFERENCE:
Note: Keeping propagation delay small can improve efficiency.
BACK-OFF ALGORITHM in CSMA/CD
 Suppose stations A and B transmit packets simultaneously. The packets collide and by virtue of collided
packets reaching back, A & B knows that collision has occurred, due to the concept of Collision
Detection in CSMA.
 They are again supposed to retransmit. When should they do it?
 If they start again at the same time, it will again result in collision. So, they should necessarily
retransmit at different times.
 For this, the BACK OFF ALGORITHM is used. The BO algorithm is used to give the waiting time for
stations involved in collision.
 When a collision is encountered, the stations have to choose a random number in the range (0, 2n-1),
where n is the collision number.
Note : The collision number is defined for the data packet.
BACK-OFF ALGORITHM (contd…)
Discussion
o Here, as we move from one case to the next, the collision probability decreases
exponentially. (Advantage)
o In Case 1, A’s and B’s winning probability is the same. Thereafter, probability that A wins
keeps increasing. (Disadvantage) .i.e, If one station wins once, then the probability that the
same station wins keeps on increasing exponentially. This is called CAPTURE EFFECT.
o The algorithm is applied only for 2 hosts. Therefore, it is also called Binary Exponential Backoff Algorithm.
o Waiting time for a station (Wt) = K*Tslot ; where K є (0, 2n – 1) & n is the collision number.
Assignment : Find the probability that A and B wins access to the channel if :
1) A won in Case 1 and B won in Case 2
2) B won in Case 1 and A won in Case 2
3) B won in Case 1 and Case 2
THANK YOU
Download