COMMUNICATION NETWORKS NETW 501 TUTORIAL 6 Presented by: Eng. Hana Hesham Eng. Mohamed Atef
Data Link Layer Data Link Layer is split into 2 sublayers which are the Logical Link Control (LLC) and the Medium Access Control (MAC) Logical Link Control: is responsible for error detection and correction and also flow control. Medium Access Control: is responsible for controlling the access of the shared medium between users. The problem in packet switching networks is that many users share the same medium. So if they all decide to access the medium at the same time the packets will collide. This is why we need to control accessing the medium using MAC protocols.
Medium Access Control Protocols Contention Based Protocols : Two or more nodes want to transmit over the same medium at the same time, examples: ALOHA Slotted ALOHA CSMA CSMA/CD CSMA/CA MACA MACA W Contention Free Protocols : Avoid collisions, MAC protocol should be able to bring the network from an arbitrary state to a collisionfree stable state, examples: FDMA TDMA CDMA Polling Token Passing Reservation Based
Carrier Sense Multiple Access (CSMA) Low throughput of ALOHA is due to waste of bandwidth due to collisions CSMA: Sense (i.e., Listen) the medium for presence of a carrier signal before transmission A terminal transmit only if a sense an idle channel Widely used in LAN with Bus Topology Vulnerable period = t prop Network Diameter A B C Station A starts transmission at time t=0 A B C At time t prop (for electrical energy to propagate from A to C) all network terminals would have listened to the transmission from A. Terminal A is said to have captured the channel
Carrier Sense Multiple Access (CSMA) Transmitter behavior when busy channel is sensed 1-persistent CSMA (most greedy [trial and error]) Start transmission as soon as the channel becomes idle Low delay and low efficiency 2-Non-persistent CSMA (least greedy) If channel is busy, immediately run the backoff algorithm to set a time to resense the channel High delay and high efficiency 3-p-persistent CSMA (adjustable/adaptive greedy) If the channel is busy, wait till channel becomes idle, transmit with prob. p; or wait one mini-slot time & re-sense with probability 1-p Delay and efficiency can be balanced
P Persistent CSMA P is a predefined value by the network administrator depending on the application requirements. In the probability outcome step we choose a random number from 0 to 1 (as flipping weighted coin), if the outcome is smaller than or equal P (this happens with probability P) then transmit, otherwise wait for another time slot (This happens with a probability 1-P) and try flipping the coin again and repeat the same criterion.
CSMA 3 persistent methods
Carrier Sense Multiple Access (CSMA)
Carrier Sense Multiple Access with collision Detection (CSMA/CD) In both ALOHA and CSMA, when collision occurs we lose at least a full transmission time for nothing TIME: t=0 Station A starts transmission TIME: t=t prop -ε Station B sense an idle channel and starts transmission A A B B CSMA/CD Abort transmission when a collision is detected TIME: t=t prop Station B detects a collision and aborts transmission TIME: t=2t prop - ε Even though Station B has aborted transmission, its initial signal arrives at A. A detects a collision and aborts transmission A A B B
Carrier Sense Multiple Access with collision Detection (CSMA/CD) A starts transmission at time t1 Z starts transmission at time t2, where t1 < t2 < t1+tp, thus a collision occurs. Collided signal (jammed) from A arrives to Z at time t4 = starting time (t1) + propagation time (tp), Then Z can detect the collision at that time. Collided signal (jammed) from Z arrives to A at time t5 = starting time (t2) + propagation time (tp), Then A can detect the collision at that time.
Carrier Sense Multiple Access with collision Detection (CSMA/CD)
P Persistent CSMA/CD analysis Assume nodes B, C and D are using P persistent CSMA. At time t they will start sensing the channel and find it busy so they keep sensing the channel until it is idle again at time ( starting time for A (=0) + Tp (=t) + Tt). They all see the channel idle at the same time so every node can transmit with probability P and wait with probability (1-P) Ta=0 A Tp=t B C Tc=t Tb=t D Td=t
P Persistent CSMA/CD analysis Here we have (n=3) stations that try to access the medium at the same time slot with probability P for each (this slot is called contention slot) Thus the probability that one node acquires the slot and transmits successfully happens when only one node choose to transmit and the (n-1) other nodes choose to wait for the next slot, this case is given as: P success = n p (1 P) n 1 (This rule comes from Binomial Distribution) P collision = 1 P success (1 p) n Ta=0 A Tp=t B C Tc=t Tb=t D Td=t Probability that only one node sends Probability that no node sends (The probability of collision in a given contention slot)
P Persistent CSMA/CD analysis Busy Contention Busy Idle Contention Busy Time Channel can be in three states: Idle: no one is transmitting on it Busy transmitting: A given node captured the channel and is transmitting on it Contention period: The time when multiple nodes can see the channel idle and compete to access the channel at the same time slot (as in the previous slide example), so nodes transmit during mini-slots with probability P and listen whether they have successfully captured the channel or not. Once one node successfully captured the channel (this happens with probability P success ) the channel moves from the contention mode to the Busy mode. Each contention mini-slot size = 2*t prop (Why? Because it is the time required for a given node to know if it successfully captured the channel or a collision happened)