4. Carrier Sense Multiple Access With Collision Detection (CSMA/CD) is a media access control method used most notably in local area networking using early Ethernet technology. It uses a carrier sensing scheme in which a transmitting data station detects other signals while transmitting a frame, and stops transmitting that frame, transmits a jam signal, and then waits for a random time interval before trying to resend the frame
5. CSMA/CD is a modification of pure carrier sense multiple access (CSMA). CSMA/CD is used to improve CSMA performance by terminating transmission as soon as a collision is detected, thus shortening the time required before a retry can be attempted.
7. There are three different types of CSMA protocols :- (i) 1-Persistent CSMA (ii) Non-Persistent CSMA (iii) P-Persistent CSMA
8. Under what conditions do collisions take place? 1. If a station begins transmission when the channel is already busy. Obviously, if one transmits when the channel is already in use, a collision will happen. Note: Pure Aloha has this problem, which is one reason its performance is poor. We can avoid these types of collisions by sensing the channel before we attempt transmission, and send only if it is idle. 2. If two stations begin transmission at (roughly) the same time, each thinking that the channel is idle. Because of propagation delay times, one station may think the channel is idle, when in fact another station has already begun transmission, but its signals have not reached the first node.
9. 1.Persistent CSMA -Sense channel, if idle then send, if busy wait until idle and then send. 1-persistent because it sends with probability of one when senses channel is idle. Collisions? Effect of propagation delay (takes time for signal to propagate from one channel to another). Even if zero could have collisions.
10. 2.Non Persistent CSMA-less greedy. Sense channel. If idle then send. If busy then wait
random amount of time before repeating the same routine. Collisions go away? No,
can still send at the same time
11. 3.P Persistent CSMA-applies to slotted channels. If channel idle then send with
probability p, with probability q=(1-p), it defers to the next time slot. Delay for
random time if channel busy.
Note: p = 1 implies we transmit immediately, p = .1, we transmit with probability .1.
The primary advantage of p-persistent protocols is that they reduce the number of
collisions under heavy load. The primary disadvantage is that they increase the
average delay before a station transmits a frame. Under low loads, the increased
delay reduces efficiency.
12. Another way to reduce the number of collisions is to abort collisions as soon as they are
detected. CSMA networks with Collision Detect (CSMA/CD) do just that. How long does
it take to detect collisions:
• at least twice the propagation delay, or 2τ (in worst case, τ for the signal to travel
from one end of cable to the other, another τ for the collision indication to travel
back)
• we’ll call this interval the contention period
• what does this say about building broadcast networks that span large distances?
(increase propagation delay) The longer the physical distance, the longer the
contention period. For satellite communication, the contention period is .5 seconds,
much longer than the transmission time for a single frame!
• small frames? (could send entire frame before detecting a collision)–pad out the
frames in the standard
15. clc;
clear all
ENERGY=1; %initialization of the energy variable
number_of_users= 5
time_for_txn=10 %total time for transmission i.e. run time
start_time=randi([1,time_for_txn],[1,number_of_users])
% random time for start of transmission
%give the matrix of 5 time on which 5 stations has started the transmission
16. while ENERGY~=0 %keep sensing untill channel is not free at transmission time
ENERGY=0;
colsn_station=[]; %intializing the collision time
for i=1:5 %for taking reffernce users
for j=1:5 % to take other frames for comparison
if start_time(1,i)==start_time(1,j) %comapare the start times%% if start time are same there will be collision
if i~=j % start time should be different for the ref. and the comparing bit
ENERGY=ENERGY+1; %if the reference and the compared frame is same enery will increase
%%%i.e. collision will be there
colsn_station= [colsn_station i] %%to show the time packets were collided
end
end
end
end
17. if ENERGY~=0 %if there is channel is not free
pg.13
for i=1:length(colsn_station)
start_time(1,colsn_station(1,i))=randi([colsn_station(1,i),10],[1,1]);
end
% change the start time of the collided statins
start_time %display the restart time
else
'tramsnission of paket sucess'
end
end
18. Main procedure 1.Is my frame ready for transmission? If yes, it goes on to the next point. 2.Is medium idle? If not, wait until it becomes ready[note 1] 3.Start transmitting. 4.Did a collision occur? If so, go to collision detected procedure. 5.Reset retransmission counters and end frame transmission.
lt;/divgt;
19. Applications
CSMA/CD was used in now obsolete shared media Ethernet variants (10BASE5, 10BASE2) and in the early versions of twisted-pair Ethernet which used repeater hubs. Modern Ethernet networks, built with switches and full-duplex connections, no longer need to utilize CSMA/CD because each Ethernet segment, or collision domain, is now isolated. CSMA/CD is still supported for backwards compatibility and for half-duplex connections. IEEE Std 802.3, which defines all Ethernet variants, for historical reasons still bears the title quot;Carrier sense multiple access with collision detection (CSMA/CD) access method and physical layer specificationsquot;.
lt;/divgt;