Ethernet Transmitter Algorithm

Prerequisite – Ethernet and Ethernet Frame Format

Ethernet Adapter or Network Interface Card (NIC) is hardware device/component, that enables you to send and receive data, to and from your computer. It will be connected to the network via wired or wireless connection.

Let us assume we have host computer, which has Ethernet Adapter. The Ethernet cable (a cable that is useful in connecting computing devices, together directly) is connected to current Ethernet Adapter (NIC card), which is part of host computer, via transceiver, which acts as both transmitter and receiver.



We can plug in Ethernet cable to port of Ethernet Adapter (NIC card). But, so as to attach Ethernet cable to port of Ethernet Adapter (NIC card), we need RJ45 socket (8 pin – standard wired Ethernet over copper cable connector).



Access Protocol for Ethernet :

  1. Algorithm is usually called Ethernet Media Access Control (MAC) and is implemented in hardware on Ethernet Adapter (NIC).
  2. Access method of Ethernet is CSMA/CD (Carrier-Sense Multiple Access with Collision Detection).
  3. Encoding method is Manchester Encoding technique for converting data bits into signals.

The reason why Manchester Encoding technique is employed – Ethernet cable is connected through port, to Ethernet Adapter. So, application layer data is given to transport layer and is forwarded to network layer and then it comes to data link layer (where NIC card is present now).

So, frames that are created by host computer, need to be placed on Ethernet cable (on channel). When host computer, wants to place data/information on channel, we want to use some encoding technique.

Encoding is vital to convert particular data/frames, created by host computer, into signals because Ethernet cable For example, copper cable carries data in form of electric signals) will only carry signals.


Ethernet Transmitter Algorithm :

  1. When adapter (host computer) contains frame to send and if line (channel) is idle, it transmits frame immediately.
  2. The upper bound of 1500 bytes (maximum size of data or payload in Ethernet frame) within message means, that adapter can occupy line for fixed length of.
  3. When adapter encompasses frame to send and if line (channel) is busy, it waits for line to go idle and transmits immediately.
  4. Ethernet is claimed to be CSMA-1 persistent protocol because adapter with frame to send, transmits with probability 1, whenever busy line goes idle.
  5. Since, Ethernet has no polarized/centralized control, it is possible for two (or more) Ethernet Adapters to start transmitting frames at identical time, either because both found path/line to be idle or both had been watching for busy line to become idle. Example – Let us assume that there are 2 host computers, connected to Ethernet cable. When both find line idle, they place their frames at identical time and this results in collision.

    Ethernet has no centralized control when frames hit one another, and this algorithm (Ethernet transmitter algorithm) will intimate host that collision has occurred. This is the reason, why Ethernet access method is named as CSMA/CD.

  6. When both Ethernet Adapters begin transmitting frames at a time, frames tend to collide on network.
  7. Since, Ethernet supports collision detection each sender is in position to see that collision is in progress.
  8. At the instant, when adapter detects that its frame is striking another frame, it makes it obvious to transmit 32-bit jamming sequence instantly (so that, other hosts know that collision has happened) and thus, host computer stops transmission presently.

    Note –
    A Jamming sequence is signal sent by tool on Ethernet network to point that collision has occurred on network. The 32-bit length is required and, is long enough to traverse whole collision domain in order that all transmitting stations can detect collision).



  9. Thus, transmitter will minimally send 96 bits just in case of collision. 64-bit preamble + 32-bit jamming sequence.

    Note –
    A preamble is used for bit synchronization, in E. 8 bytes of preamble and start of frame create pattern of 64 bits.

The reason why host computer needs to send 96 bits: host computer should send 32-bit jamming sequence to point collision went on and just 32 bits is insufficient. Hence, it must append 64-bit preamble.

Runt Frame :
We know that Ethernet will not create any frame that is less than minimum length of 64 bytes. It can be seen that runt frames are commonly caused by collisions. When 2 frames collide, it leads to collision, giving rise to “Runt frame”.

The other causes of runt frames are :

  1. Malfunctioning of network card / NIC card.
  2. Buffer under-run (It is state occurring when buffer is accustomed to communicating between two devices or processes is fed with data at slower speed than data/information that is being read from it).
  3. Duplex Mismatch (one side of line is running in half duplex mode & other side in fully duplex mode) / software issues.


Ethernet Transmitter Algorithm – Worst Case Scenarios :


  1. ‘A’ (host computer) sends frame at time ‘t1’.
  2. A’s frame arrives at ‘B’ (destination computer) at time ‘t1+d1’. (‘d1’ : delay in transmission or propagation).
  3. ‘B’ begins transmitting at time ‘t1+d1’ and collides with A’s frame.
  4. ‘B’ runt frames (32 bit) arrives at A, at time ‘t1+2d1’.

Let us assume that there are 200 bits in frame and, all bits are transmitted and received by ‘B’, except last bit. Time at which last bit is received by ‘B’, is same time at which ‘B’ begins its transmission. Because of this, single bit collision occurs. Here, when ‘B’ begins transmission at ‘t1+d1’, frame from ‘A’, arrives at ‘B’ at the same time i.e ‘t1+d1’. Hence, both frames become unusable. This frame becomes runt frame. Time at which ‘B’ starts transmitting frames is ‘t1+d1’, and therefore time at which frames reach ‘A’ is ‘t1+d1+d1’ = ‘t1+2d1’.

Exponential Back-off :

  • Exponential Back-off is technique utilized by Ethernet to cut back probability of collision.
  • Once Ethernet Adapter detect collision and stops, it’s transmission/conveyance, it waits for certain amount of time.
  • After looking ahead to certain amount of time, Ethernet Adapter tries transmitting again. If Ethernet algorithm still finds channel busy, it doubles waiting time before trying again. If node waited for 1 second initially, it would then wait for 2 seconds, then 4 seconds, then 8 seconds, until channel goes idle.
  • When channel is finally idle, Ethernet Adapter places frame in channel.
  • This strategy of multiplying delay interval by two times between each re-conveyance attempt is ‘Exponential Back-off’.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


2


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.