CS485 Sylabus

### CSMA/CD: Carrier Sense Multiple Access with Collision Dectection (Ethernet - close enough...)

• Collision Detection

• Detecting collision:

• Sounds simple:

 Sender transmits... While transmitting, receive your own transmission Check what you receive is equal to what you have transmitted

• Reality:

 Sender is very close to its own transmission The signal strength is overwhelming It took quite a while for engineers to develop circuitry to enable collision detection...

• Improving the performance with Collision Detection

• Short coming of pure CSMA:

• Although at the time of transmission, the channel is idle, there are still collisions possible.

Example:

 In 1-persistent CSMA, two senders are waiting for the end of the current transmission When the current transmission ends, the channel is idle Both sender will transmit in the next slot... Collision....

NOTE:

 There is no collision detection in pure CSMA In the example above, both transmissions will be continued until the whole frame is transmitted

• Improving the performance with Collision Detection

• Nodes equipped with detect collision will abort their transmissions when a collision has been detected

• Result:

 The remainder of the frame transmission time is not wasted

NOTE:

 CSMA with collision detection do not use slotted transmissions (It's pointless to detect collsion at the start of a slot and then wait until the end of that slot...)

• Backoff !!!

• Fact after a collision:

 When a node has detected a collision, it knows that there is at least one other node that wants to transmit (In fact, all nodes involved in a collision is aware of this fact)

Question:

 How can a node avoid (reduce the likelihood of) another collision ???         NOTE: the method must work without exchanging information with other nodes !!! (no communication allowed, because we are trying to communicate :-))

 Use a backoff algorithm to auto-determine your own retransmission schedule

• Generic Backoff Algorithm:

 ``` Pick a random number r Wait r × τ Start over from the beginning... ```

&tau = maximum end-to-end delay in the LAN:

• Time unit used for backoff

• Notice the backoff procedure uses τ as time unit:

 Wait r × τ

Question:  why ?

• Comtemplate on this goal:

• Our goal is to avoid a subsequent collision

• Desired property of the Backoff algorithm:

 When 2 nodes pick different random numbers, they will reschedule their transmissions that will not result in a collision.

(Obviously, when two nodes pick the same random number, their rescheduled retransmissions will collide again...

They may need to try many times before succeeding...)

• Consider the following situation where backoff time unit is < τ

Result:

 Eventhought nodes B and C selected different random values, their retransmissions collided

• Now contrast the above with the following situation where backoff time unit = τ

• Result:

 Node C was able to detect B's retransmission before it's waiting time expires !!!

• Duration of channel sensing

• Question:

 Does a nodes need to sense the channel during the entire transmission of its frames ? Or can the node stop sensing the channel after some period of time ? If so, how long ???

• Consider the example:

• Observation:

 After &tau time, B's transmission will be heard by all nodes on the network... After this time, all nodes will refrain from transmitting !!!! Just before time τ, node C begins a transmission (it senses the channel is idle) C's transmission will cause a collision Node B will detect the collison at time 2 × τ So if B has not detect a collision after 2× τ time, there will not be any collision !!!

• So: a node can stop sensing the channel after it has transmitted (successfully) for 2 × τ time

• Setting the value of τ

• There is a maximum cabling length in a LAN

Examples: IEEE 802.3 specification

 100BaseTX - Requires category 5 two pair cable. Maximum distance is 100 meters. 100BaseT4 - Requires category 3 cable with 4 pair. Maximum distance is 100 meters. 100BaseFX - Can use fiber optic to transmit up to 2000 meters. Requires two strands of fiber optic cable.

• Divide the maximum spanning distance by 2×108 m/sec (speed of light in copper and fiber optic) to get the maximum end-to-end delay &tau

• Non-persistent CSMA/CD:

• Flow chart for the Non-persistent CSMA/CD protocol:

• NOTE:

 After detecting a collision, a node will send a jamming signal for a short duration. This is to make sure that the other transmitting node(s) will also detect a collision

• 1-persistent CSMA/CD:

• Flow chart for the 1-persistent CSMA/CD protocol:

• The Ethernet

• Ethernet MAC

 Ethernet uses the 1-persistent CSMA/CD MAC protocol

• The Ethernet Frame format

 ``` 7 bytes start 48 bit 48 bit 16 b 46 B <= n <= 1500 B 32b +-----------+----------+-------+------+--------+--------------------+-----+ | Preamble | 10101011 | Src | Dest | Length | Network Layer Data | CRC | +-----------+----------+-------+------+--------+--------------------+-----+ ```

NOTE: sequence numbers ?

 There is no sequence numbers in Ethernet frames !!!          So no reliability functions !

• NOTE:

 The Source ID identifies the sender The Destination ID identifies the receiver You must do this in a broadcast network because the frames is received by all nodes in the network

• Pre-amble:

• The pre-amble is used to pad the Ethernet frame

• It makes sure that that the source will remain active long enough to perform the collision detection function.

It 2 sources send very small message, then they can finish transmitting without detecting a collision !

Example:

• "Ethernet" and the IEEE 802.3 Standard

• Ethernet:

 "Ethernet" originally referred to the protocol implementation standardized by Digital, Intel and Xerox. This standard is now known as the DIX standard.

• IEEE Standard for "Ethernet"

 The IEEE 802.3 protocol standard describes another 1-persistent CSMA/CD protocol that is very close to the DIX Ethernet standard. DIX Ethernet and 802.3 differ slightly in the frame format and are in most respects identical.

• Today, the term "Ethernet" refers generically to both the DIX Ethernet implementation and the IEEE 802.3 standard.

• Design of the Backoff Protocol

• Purpose of Backoff:

 The backoff protocol is invoked when you have had a collision The goal of the backoff protocol is to re-schedule the transmissions, so that the likelihood of (future) collisions is minimized.

(The Backoff protocol must operate without communicating with any other nodes in the network...)

• A simple-minded backoff protocol:

 Pick a random number r between [0..N]             (N is fixed) Wait r × τ time Repeat from the beginning....

• Weakness:

 If N is small, and the system is busy, then you will have many consecutive collisions If N is large, and the system is lightly loaded, then a node may select a large value and waits very long time (waste channel bandwidth) before it will transmit...

• Conclusion:

 We need a dynamic backoff algorithm....

• The Exponential Backoff Protocol

• Purpose:

 Allow nodes in a 1-persistent CSMA/CD network to auto-schedule their re-transmissions dynamically

• How (in a nutshell):

 Every attempt of re-transmissions will be preceeded by a random delay The duration of the random delays will be increasing with the number of attempts made

• The Exponential Backoff Algorithm:

• Set N=1 (= # retries)

• For the first retransmission attempt (N == 1), a node picks a random number r from the range:

 r ∈ [0, 21-1]     =     [0..1]

(The node will wait r × τ time and retries the transmission using CSMA/CD !!!!).

The retransmission can be successful (then you're done) or it can result in another collision...

• It there was another collision, increase N (= 2).

And for the second retransmission attempt (N == 2), a node picks a random number r from the range:

 r ∈ [0, 22-1]     =     [0..3]

(The node will wait r × τ time and retries the transmission using CSMA/CD !!!!).

The retransmission can be successful (then you're done) or it can result in another collision...

• It there was another collision, increase N (= 3).

And for the third retransmission attempt (N == 3), a node picks a random number r from the range:

 r ∈ [0, 23-1]     =     [0..7]

(The node will wait r × τ time and retries the transmission using CSMA/CD !!!!).

The retransmission can be successful (then you're done) or it can result in another collision...

• And so on...

• Small problem:

 The range can become insanely large (Exponential grow is something to be feared....)

Solution:

• Set an upper bound on the range

The maximum range from which the random numbers are selected is:

 [0..210-1]     =     [0..1023]

• Fairness of the Ethernet's backoff algorithm

• Question:

 Is there the possibility that a node will wait indefinitely to transmit in Ethernet ?

• Yes, there is

• Consider the following sequence of events:

• Now, while A is transmitting, node B wants to transmit...

When A finishes its transmission, we will have another collision:

• Question:

 What is the chance that C will transmit before B ?

Calculation:

• C will transmit before B when C picks a smaller value than B:

 C picks 0 and B picks 1

• The probability that C will pick 0 is 0.25

The probability that B will pick 1 is 0.5

• The chance that C will transmit before B is:

 0.25 × 0.5    =    0.125

• Question:

 What is the chance that B will transmit before C ?

Calculation:

• B will transmit before C when B picks a smaller value than C:

 B picks 0 and C picks 1 B picks 0 and C picks 2 B picks 0 and C picks 3 B picks 1 and C picks 2 B picks 1 and C picks 3

• The probability that C will pick any one number is 0.25

The probability that B will pick any one number 0.5

• The chance that C will transmit before B is:

 (0.25 × 0.5) + (0.25 × 0.5) + (0.25 × 0.5) + (0.25 × 0.5) + (0.25 × 0.5)    =    0.625

Conclusion:

 This is not fair !!!

• And the bad news is:

 It will get even worse if C loses again ...

Suppose node B transmits first and during B's transmission the node A, scheduled a transmission.

Then:

The likelyhood that node C will transmit first is now very very slim...

• NOTE:

• This same problem will also happen when 2 nodes have many packets to transmit...

• The result will be the node that succeeds first in transmitting will have an edge in the retransmission attempts

• This problem is very well-known, and it is called the:

 "Ethernet Capture Effect"