Hi, today we are going to dive into a feature called CSMA/CD which stands for Carrier Sense Multiple Access Collision Detection. This is a protocol mostly used by Ethernet NICs when they are connected to half-duplex networks such as being connected to ethernet hubs and plays an important role in handling what to do after collisions. Before we dive into, I first want to talk about some key concepts to know which are half-duplex and full duplex.
Half-Duplex
half-duplex is a mode where a device’s link can both transmit and receive but they cannot do so simultaneously. If a PC is receiving something then it must not be transmitting or if the PC is transmitting that the PC on the other end of the link must not be transmitting. Think of a walkie talkie and how it functions, are they able to communicate simultaneously? Of course not, the same thing is happening here. If both PCs were transmitting at the same time, a collision would happen. In this situation the electrical electrical signals would interfere with each other, causing the data to become corrupt.
Full-Duplex
full-duplex is a mode where a link on a network device can both transmit data and receive data simultaneously without any kind of collision or interference. full-duplex is point to point only versus half-duplex which shares a medium. In full duplex, devices are able to transmit and receive data simultaneously without having to worry about if other devices are also transmitting. Think of full-duplex as a phone call, when you are talking to somebody both of you can talk freely and at the same time and nothing happens. full-duplex works the same way, being able to make network communication between devices more smooth with less corrupted data.
CSMA/CD
So now that you know what half-duplex and what full-duplex is, let’s talk about CSMA/CD. CSMA/CD is only applied to half-duplex devices and the most common half-duplex device is an ethernet hub. Ethernet hubs are not capable of full-duplex which is why they are mostly obsolete. CSMA/CD is broken into 3 parts, and the first part is carrier sense. When CSMA/CD is enabled, during carrier sense the PC’s NIC listens to the ethernet medium that is connected to the hub. It is listening to the medium to make sure that no other PC’s NIC is transmitting anything. If the PC detects that electrical signal is being transmitted then it waits, if the PC’s NIC detects that the ethernet medium is free and clear then it transmits. Next is CSMA/CD is multiple access, which means that the medium is shared by multiple other hosts. When CSMA/CD is activated, the hosts connected to the ethernet hub are aware that an electrical signal can be transmitted from another source at any time. Last but not least, collision detection. Collision detection occurs when an actual collision happens. Yes, collisions can still happen even when the PC’s NIC does the necessary steps. During transmission, the PC’s NIC is still listening to the ethernet medium to ensure that the electrical signal has not been corrupted meaning there was a collision. When a collision occurs CSMA/CD does a process on what to do after. So say PC1 sent an electrical signal over the medium because it said that it was clear, but PC2 thought it was free as well causing them both to transmit at the same time. When a collision occurs the PC’s NIC will detect that a collision has occurred and send out a “jam electrical signal.” A jam electrical signal is a notification that is sent to every host connected to the hub that a collision has occurred. Once every PC has received this jam electrical signal, all the hosts will wait a random backoff time. This time is completely random and unique to every host connected to the hub. This random backoff time is calculated using the exponential binary backoff algorithm, and increases waiting time after every sequential collision. Since the time is completely random and unique per host, once the timer ends the coast is clear for the host to start transmitting collision free. One last thing is the configuration of CSMA/CD. This is a feature that is automatically used by a PC’s NIC, nothing needs to be configured by a network engineer. Once the PC’s NIC detects that it is operating at half-duplex CSMA/CD will automatically be used, if it detects full-duplex then it is disabled because collision cannot occur on full-duplex links.
Leave a Reply