Assume n nodes all trying to send. Each will send with probability p (and refrain from sending with probability 1-p).
The probability of an arbitrary node sucessfully transmitting a frame (meaning that it sends, and all other nodes refrain from sending) is
p ⋅ (1 - p)n-1
The probability of some node successfully transmitting is thus
n ⋅ p ⋅ (1 - p)n-1
The probability p that maximizes this formula is 1/n. So, for an arbitrarily large number of nodes, the probability of a slot being successfully utilized in slotted ALOHA is
lim n → ∞ (1 - 1/n)n-1 = 1/e ≈ .37
So even in the best case, slotted ALOHA utilizes less than 50% of the capacity of the broadcast medium.
Pure ALOHA is a version of ALOHA that does not use slots: senders may begin sending at any time. In this case, the probability of a node transmits successfully IFF
The probability of an interfering transmission doubles, resulting in utilization of 1/2e, half that of slotted ALOHA.
The main problem with ALOHA (Slotted and Pure) is when a sender decides to start transmitting, it does not consider the possibility that another node is already transmitting.
Carrier Sensing is the policy that before transmitting, a sender senses the communication medium to see if any other node is already transmitting, and holds back until the medium is idle. CSMA, or Carrier Sense Multiple Access, describes any protocol where senders perform carrier sensing before transmitting.
With carrier sensing, many collisions can be avoided. However, because signals require time to propagate, it is still possible for two nodes to carrier sense, find the medium idle, and then transmit simultaneously.
In Collision Detection, nodes sample the communication medium while they are transmitting. If an interfering signal is detected, then they abort the transmission. This allows collisions to be detected quickly, instead of wasting an entire frame's worth of time on a frame that has been partially garbled by a colliding transmission.
Ethernet is the most prevalent link-layer technology and protocol for local area networks. In its basic form, it is a bus architecture, with all stations connected to a common pair of wires, which are used for both transmitting and receiving. It uses CSMA/CD (Carrier Sense Multiple Access with Collision Detection) as its multiple access protocol.
+----------+-----------+-------------+------+-----------------+-----+ | Preamble | Dest addr | Source addr | Type | Data [Padding] | CRC | +----------+-----------+-------------+------+-----------------+-----+
When a collision is detected, a sender will transmit a jam signal to make sure that all other stations detect the transmissions (and discard the garbled frame).
After detecting a collision, a sender will enter an exponential backoff phase. At each step K of exponential backoff, the sender chooses a random value t in the range 1..2min(K,10) and waits 512⋅t bit times. Exponential backoff gracefully handles collisions involving an arbitrary number of senders all wishing to transmit: with high probability, any sender will eventually be able to transmit successfully following a collision. However, the service provided by ethernet is unreliable, best-effort delivery.
Rather than attaching ethernet stations to a single physical pair of wires, they are usually attached to a hub or a switch. This is the case for all modern ethernet hardware (e.g., 10baseT, 100baseT).
Hubs and switches connect stations in a star topology:
Each station is directly connected to the hub or switch, allowing communication between all attached stations. Hubs and switches may be connected to each other, allowing communication between all stations attached to any of the interconnected hubs and switches.
Hubs operate by replicating input signals arriving at any port of the hub and replicating them on all other ports. Thus, two stations attached to the same hub are said to be in the same collision domain: collisions are possible and are detected and handled the usual way.
Switches operate in a way that is very similar to routers: they read frames from an input port, determine the output port through which the recipient may be reached, and forward the frame directly to that output port. For this reason, collisions generally do not occur in a switched ethernet network.
Switches work by learning (based on the source address of received frames) the links that each station is connected to. This information is entered into a forwarding table in much the same way as a router. Unlike a router, switches build their forwarding table in a way that is completely automatic. If a frame arrives with a destination address that is not known (not in the forwarding table), then the switch broadcasts the frame to all output ports.
Although switches have the desirable property of self-configuration, they are not a substitute for routers. First, they may only be interconnected in a tree topology. A cycle in a network of ethernet switches could easily lead to a broadcast storm. In addition, the size of a forwarding table in a switch is directly proportional to the number of states attached to the entire ethernet network. This would not scale because there is no way to aggregate a multiple addresses into a single entry (they way that internet routers do with CIDR address prefixes that can forward datagrams to any host in the subnet matched by the prefix).