We will talk about MAC protocols and Ethernet technology, both operating at the lowest two layers of the OSI model, which corresponds to the Link layer in TCP/IP.
In 10Base-2 and 10Base-5 networks, hosts share the same medium of communication.
Hosts on a shared Ethernet network physically connect to the same medium.
Questions arise regarding who and when to send data on the medium first.
→ Medium Access Control protocols -aka MAC protocols- are the protocols that regulate communication on shared medium.
There are three main MAC protocol families:
Packet-switched radio networks
eg. Aloha protocol
- “whenever I have data to send, I simply send it on the medium”
- “if there is collision, I send at a later time”
- –> the algorithm is simple and has random behavior.
- with higher loads on the medium, collision rate increases and hosts spend more time re-sending data than sending new data
- → engineers thought of improvements for the Aloha protocol, such as listening on the medium ( hence the term “carrier sense”) before sending data
Used in shared Ethernet and the early days of 10Base-T and 10Base-F Ethernet, where we use hubs to interconnect network hosts. Nowadays, CSMA/CD is still implemented in switches but unused, where Fast Ethernet, Gigabit Ethernet and 10G Ethernet technologies are more and more common and affordable.
Token Passing protocol
eg. Token Ring: A token packet is exchanged between hosts. No host can transmit data unless he has the token
Let’s take a deeper look at CSMA/CD.
CSMA/CD is a contention-based protocol. Its principle is the following: contending hosts listen for the carrier signal on the medium. and ensure the channel is free (remember that only one packet must travel on the medium and that packet lengths are variable). The presence of the carrier signal on the medium is normal, since it is the signal that we would use to modulate the message signal (see more details about the carrier here). Only one host should send at a time. So only one frame must traverse the medium at any time.
Unfortunately, it happens to be that some hosts put a frame on the wire at about the same time, which creates a collision. That’s because hosts listen only on the small part that connect them to the medium. They can not listen for the carrier on the whole medium unfortunately. Thus, whenever there is a collision on the other end of the medium, hosts can not detect it and will assume that the medium is free.
Contending hosts send their frames while continually sensing the carrier for possible collisions. If they detect a collision
- they almost immediately stop sending,
- they send a jamming signal that reaches all contending hosts on the medium,
- they resend at a later time according to random time algorithm called the Binary Exponential Backoff. The value of the waiting time increases exponentially each time a collision is observed.
Hosts on a medium detect collisions at different time, as the colliding signals are traveling on the medium.
[box type=”note” align=”aligncenter” ]A collision is detected in many ways such as:
- an increase of amplitude of a signal (voltage),
- an increase of the number of transitions in the signal, if we use Manchester coding. Manchester coding uses two transitions: one in the beginning of the bit time to reset the state of the signal, and the second is in the middle of the bit time)
When there is a collision, both colliding signals continue traveling in opposite directions. This allows for all hosts on the medium to detect the collision.
Let’s suppose hosts A and B sent data and a collision occurs. Both colliding signal travel in opposite directions. A colliding signal is observed by host A. A detects the collision. But how can host A know that the collision involves its own signal? Who can tell that it is not C’s signal (C is another host on the medium) that created the collision?
The CSMA/CD condition in making hosts guilty
There is a condition in CSMA/CD that helps hosts detect if the collision is caused by their own signals or not. It relates to the minimum packet length. Whenever A sends data to B, then in order for A to detect a collision that involves its own signal, the packet length per data rate ratio must be greater or equal to two times the length of the medium divided by the speed:
P/R >= 2*L/C
- P: the Packet length
- R: the data rate of the medium
- L: the length of the medium from A to B
- C: the speed of light
CSMA/CD is used in Shared Ethernet networks, such as those with hubs and repeaters. However, with the arrival of Ethernet switches, CSMA/CD is no longer useful because the segment that links one host to another is not shared anymore. A switched path is a dedicated electrical path where collision should not occur.
- Introduction to Computer Networking, Stanford University
- TCP/IP Illustrated: The Protocols