Carrier sense multiple access with collision detection

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Simplified Algorithm of CSMA/CD. Station checks if another station is transmitting, if not it sends the first bit of information. If no collision is detected it will continue to send the other bits of information while continuously checking if a collision has been detected. If a collision is detected it will calculate a random amount of time to wait and start the process again. If the maximum amount of attempts is reached then no transmission is possible and it will be aborted.

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.[1]

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.

Procedure[edit]

The following procedure is used to initiate a transmission. The procedure is complete when the frame is transmitted successfully or a collision is detected during transmission.[2]:33

  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 and monitor for collision during transmission
  4. Did a collision occur? If so, go to collision detected procedure.
  5. Reset retransmission counters and end frame transmission.
Collision detected procedure

The following procedure is used to resolve a detected collision. The procedure is complete when retransmission is initiated or the retransmission is aborted due to numerous collisions.

  1. Continue transmission (with a jam signal instead of frame header/data/CRC) until minimum packet time is reached to ensure that all receivers detect the collision
  2. Increment retransmission counter
  3. Was the maximum number of transmission attempts reached? If so, abort transmission.
  4. Calculate and wait random backoff period based on number of collisions.
  5. Re-enter main procedure at stage 1.

This can be likened to what happens at a dinner party, where all the guests talk to each other through a common medium (the air). Before speaking, each guest politely waits for the current speaker to finish. If two guests start speaking at the same time, both stop and wait for short, random periods of time (in Ethernet, this time is measured in microseconds). The hope is that by each choosing a random period of time, both guests will not choose the same time to try to speak again, thus avoiding another collision.

Methods for collision detection are media dependent, but on an electrical bus such as 10BASE-5 or 10BASE-2, collisions can be detected by comparing transmitted data with received data or by recognizing a higher than normal signal amplitude on the bus.

Jam signal[edit]

The jam signal or jamming signal is a signal that carries a 32-bit binary pattern sent by a data station to inform the other stations of the collision and that they must not transmit.[3]

The maximum jam-time is calculated as follows: The maximum allowed diameter of an Ethernet installation is limited to 232 bits. This makes a round-trip-time of 464 bits. As the slot time in Ethernet is 512 bits, the difference between slot time and round-trip-time is 48 bits (6 bytes), which is the maximum "jam-time".

This in turn means: A station noting a collision has occurred is sending a 4 to 6 byte long pattern composed of 16 1-0 bit combinations. Note: The size of this jam signal is clearly beyond the minimum allowed frame-size of 64 bytes.

The purpose of this is to ensure that any other node which may currently be receiving a frame will receive the jam signal in place of the correct 32-bit MAC CRC, this causes the other receivers to discard the frame due to a CRC error.

Late collision[edit]

A late collision is a type of collision that happens further into the packet than is allowed for by the protocol standard in question. In 10 megabit shared medium Ethernet, if a collision error occurs after the first 512 bits of data are transmitted by the transmitting station,[4] a late collision is said to have occurred. Importantly, late collisions are not re-sent by the NIC unlike collisions occurring before the first 64 octets; it is left for the upper layers of the protocol stack to determine that there was loss of data.

As a correctly set up CSMA/CD network link should not have late collisions, the usual possible causes are full-duplex/half-duplex mismatch, exceeded Ethernet cable length limits, or defective hardware such as incorrect cabling, non-compliant number of hubs in the network, or a bad NIC.

Applications[edit]

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 "Carrier sense multiple access with collision detection (CSMA/CD) access method and physical layer specifications".

Notes[edit]

  1. ^ On Ethernet, stations must additionally wait the 96 bit interframe gap period.

References[edit]

  1. ^ "Carrier Sense Multiple Access Collision Detect (CSMA/CD) Explained". Retrieved 2011-07-29. 
  2. ^ Heinz-Gerd Hegering; Alfred Lapple (1993). Ethernet: Building a Communications Infrastructure. Addison-Wesley. ISBN 0-201-62405-2. 
  3. ^ Forouzan, Behrouz A. (2010). TCP/IP protocol suite (4th ed.). Boston: McGraw-Hill Higher Education. p. 54. ISBN 0073376043. 
  4. ^ IEEE 802.3-2008 Section 1, IEEE section 5.2.2.1.10