A collision is an event that happens on an Ethernet network when two stations simultaneously “talk” on the wire. Collisions are a normal part of life in an Ethernet network, and under most circumstances should not be considered a problem.
In this document, we will discuss:
- The events leading up to and immediately following a collision.
- The difference between an “early”, and a “late” collision.
- This article contains separate Figures that are referenced in the text and may be loaded if you want to see them. The figures augment the text of the article.
- There are two separate discussions on this page: Early Collisions and Late Collisions.
In this discussion, we will refer an imaginary Ethernet network consisting of Stations A and B, and any number of other stations. The status of the network is such that the wire is idle (nobody is talking) and 9.6 microseconds have passed since anybody last talked on the wire.
An early collision is any collision that occurs before 512 bits of the frame have been put onto the wire. The rationale behind this is discussed in the next essay.
The following is an outline of a normal or “early” collision event:
- Station A, detecting that the wire has been idle for 9.6 microseconds, begins to transmit its data frame, beginning with the 64 bit preamble. While Station A is transmitting, it is also listening for abnormal voltage on the wire — a signal that a collision has occurred. (Fig. 1)
- Some period of time later, but before the signal from Station A has had time to propagate down the wire to Station B, Station B also detects that the wire has been idle for 9.6 microseconds, and begins to transmit its data frame beginning with the 64 bit preamble. Station B is also listening for a collision on the wire. (Fig. 2)
- At some point on the wire in between Station A and Station B, the electrical signals overlap, creating a point of abnormal voltage. As the signals continue to propagate, this abnormal voltage travels down the wire towards both Station A and Station B. (Fig. 3)
- Whichever station is closest to the physical point on the wire where the two signals overlapped will detect the collision first. For the sake of this discussion, we will say that Station A detects the collision first. (Fig. 4)Station A, detecting the abnormal voltage on the wire, and realizing that a collision has occurred, immediately stops transmitting data and transmits a 32 bit “jam” onto the wire. (Fig. 5) The 32 bit jam consists of any combination of values that is not a valid CRC for the frame that was just interrupted by the collision. Most Ethernet cards today just send 32 ones and know that there is only a 1/(2^32) chance that that will be the checksum — pretty good odds. The purpose of the 32 bit jam is to fully propagate the wire with voltage, preventing anybody else from talking.
- Station A will then implement an algorithm known as the Truncated Binary Exponential Backoff Algorithm, which determines how long it will wait before it attempts to retransmit the frame that was just interrupted. The interrupted frame is referred to as a runt.
- Next, Station B will detect the collision. Station B will also send a 32 bit jam and implement the Truncated Binary Exponential Backoff Algorithm. (Fig. 6)
Early collisions occur regularly in a normally operating Ethernet network. There is no hardware malfunction or misbehaving station — it just so happens that two NICs start to talk at the same time. Generally, after the talkers implement the backoff algorithm, which is specially designed to not have both NICs attempt to talk at the same time again, both talkers will successfully put their frame onto the wire. It typically takes no longer than 2-3 milliseconds for a station to recover from a collision and successfully retransmit its frame.
Late collisions, on the other hand, are not normal, and are usually the result of out of spec. cabling or a malfunctioning adapter. A late collision is defined as any collision that occurs after 512 bits of the frame have been transmitted. The rationale behind this is discussed in the next essay.
In this discussion, we will refer to the same network described in the discussion of early collisions, but with one modification: In this network, the network administrator has violated the maximum cable length (500 meters for 10BASE5 thick ethernet, 185 meters for 10BASE2 thin ethernet) by either adding too many repeaters in between Stations A and B, or just laying too much wire between them.
The following is an outline of a late collision event caused by out of spec. cabling:
- Station A, detecting that the wire has been idle for 9.6 microseconds, begins to transmit its data frame, beginning with the 64 bit preamble. Station A transmits 256 bits of its frame. If the cabling were in spec, and Station B began to transmit, causing a collision, even if Stations A and B were on the farthest ends of the wire from each other, the collision would be detected by station A before it could transmit its 512th bit. (Fig. 1)
- Station A continues to transmit bits, and meanwhile, down at the other end of the wire, just before the electrical signal reaches Station B, Station B detects idle wire for 9.6 microseconds and begins to transmit. (Fig. 2)
- A minute amount of time later, a collision occurs. (Fig. 3) Station B, being extremely close to the collision, detects it first, and begins transmitting a 32 bit jam signal. (Fig. 4)
- The collision begins to propagate down the wire towards Station A, but, because the cabling was out of spec, by the time it gets to Station A, Station A has already finished transmitting, and is no longer listening for collisions! (Fig. 5) Station A is completely unaware that a collision has occurred!
- The reason that late collisions are a problem is that once the NIC misses the fact that a collision has occurred, recovery and retransmission are left to the upper layers, and recovery time goes up drastically. While a NIC will typically recover and retransmit a frame in 2-3 milliseconds, it typically takes anywhere from 10 to 100 times that long for upper layers.
The other major cause of late collisions is a malfunctioning NIC. If a NIC malfunctions in such a manner that it is unable to detect that another station is talking, late (and early) collisions will occur.
- Collisions Fig. 1
Station A detects 9.6 microseconds of idle time and begins to transmit. At the same time, it is listening for collisions.
- Collisions Fig. 2
Before the signal from Station A has time to propagate down the wire to Station B, Station B detects 9.6 microseconds of idle time and begins to transmit a frame.
- Collisions Fig. 3
The electrical signals “collide” and overlap, causing abnormal voltage on the wire. The collision travels down the wire in each direction.
- Collisions Fig. 4
Station A is closest to the point of collision, so it detects the collision first. Upon detecting the collision, Station A stops transmitting data.
- Collisions Fig. 5
Station A transmits a 32 bit “jam,” usually consisting of all ones. The purpose of the jam is to keep anybody else from trying to talk on the wire. Station A then implements the Truncated Binary Exponential Backoff Algorithm.
- Collisions Fig. 6
Station B detects the collision a short time later and also sends a 32 bit jam. It then implements the Truncated Binary Exponential Backoff Algorithm.
- Late Collisions Fig. 1
Station A detects 9.6 microseconds of idle time and begins to transmit. At the same time, it is listening for collisions. In this case, remember that for one reason or another, the network is violating the maximum cable length specification for whatever type of cabling is being used (500 meters for 10 BASE-5 thick Ethernet, 185 meters for 10 BASE-2 thin Ethernet).
- Late Collisions – Fig. 2
Just after Station B begins to transmit, a collision occurs.
- Late Collisions – Fig. 3
Just after Station B begins to transmit, a collision occurs.
- Late Collisions – Fig. 4
Station B detects the collision and begins transmitting a 32 bit jam. Meanwhile, the collision event travels down the wire towards Station A.
- Late Collisions – Fig. 5
Station A finishes transmitting and therefore stops listening for collisions. Because the network length is out of spec, however, the collision event has not yet reached it. Station A is never aware that the collision occurred. When Station A sees the 32 bit jam, it will just think that some other stations collided and ignore it.