SANAA
UREMBO NA USTAWI
UJANJA
UTAMADUNI NA HISTORIA
BURUDANI
MAZINGIRA
CHAKULA NA VINYWAJI
UHANDISI WA KINYUME
SAYANSI
MICHEZO
TEKNOLOJIA
VAZI
ALOHA and Random Access
Volt

Imeundwa na

Volt

30. Agosti 2026SE
28
0
0
0
0

ALOHA and Random Access

The University of Hawaii had a problem no mainland university had. Its campuses were on different islands, leased telephone lines between islands were expensive and poor, and the terminals needed to reach one computer in Honolulu. Norman Abramson's answer in 1971 was to give up on coordination entirely. Every terminal shares one radio channel. When it has something to send, it sends. If two transmissions overlap, both are destroyed — and the sender finds out because the acknowledgement does not come back on the separate downlink, so it waits a random time and tries again. It sounds like it should not work, and the remarkable thing is exactly how badly it works: the maximum throughput of pure ALOHA is one over two e, about eighteen percent of the channel. Eighty-two percent is spent on collisions and silence. But eighteen percent of a shared channel that needs no scheduler, no master station and no coordination at all was far more than the islands had before. Then Larry Roberts noticed in 1972 that most of the waste is the sloppy timing. If everyone may only begin on a slot boundary, a packet can only be ruined by something starting in the SAME slot rather than in a window two packets wide. Halving the vulnerable period doubles the throughput to one over e, about thirty-seven percent, for the cost of a shared clock. This blueprint and the Ethernet one that follows share a rig, deliberately. Build the hardware once, run it blind, then slotted, and measure the two numbers yourself before adding the one thing ALOHA cannot do — listen first.
Kati
4 hours

Maagizo

1

Build the shared channel

Four microcontrollers, one shared channel, no master. The simplest honest version is a single wire pulled up to the rail by one resistor, with every board driving it through a diode or an open-drain output — so anyone may pull it low and nobody can force it high. If you would rather it be radio, as ALOHAnet was, point four infrared LEDs at one phototransistor. Either way the essential property is the same: two stations transmitting at once produce garbage that neither of them, and no receiver, can decode. Add a fifth board as the receiver and the acknowledgement source. It listens, checks the CRC from blueprint 2, and pulses an acknowledgement line when a frame is good. That acknowledgement is the ONLY feedback a sender gets, and its absence is the only way a sender ever learns a collision happened. Keep this rig assembled. The next blueprint uses it unchanged.

Vifaa kwa hatua hii:

Resistor KitResistor Kit1 kipande
LED AssortmentLED Assortment1 kipande
Optical Detector / Phototransistor - QRD1114Optical Detector / Phototransistor - QRD11141 kipande
Jumper Wire SetJumper Wire Set1 kipande

Zana zinazohitajika:

ESP32 Development BoardESP32 Development Board
Breadboard - ClassicBreadboard - Classic
Digital OscilloscopeDigital Oscilloscope
Bench Power Supply (30V/5A)Bench Power Supply (30V/5A)
2

Measure 18 %, then measure 37 %

Program every station identically: when it has a frame, send it immediately; if no acknowledgement arrives within a timeout, wait a random interval and retry. That is pure ALOHA and nothing more. Sweep the offered load by changing how often each station generates a frame, and at each setting count frames DELIVERED per unit time against frames ATTEMPTED. Plot it. You will find the curve rising, peaking near eighteen percent, and then FALLING as you push harder. Do not stop at the peak — the falling half is the important half, and watching a channel deliver less as you offer more is the clearest possible demonstration of congestion collapse. Now add a shared clock: have the receiver pulse a slot line and let stations begin only on that pulse. Change nothing else. Re-run the sweep. The peak roughly doubles, to about thirty-seven percent, and it moves to a higher offered load. One shared clock, twice the throughput. Write both numbers down; blueprint 8 beats them.

Zana zinazohitajika:

ESP32 Development BoardESP32 Development Board
Digital OscilloscopeDigital Oscilloscope
Desktop ComputerDesktop Computer
StopwatchStopwatch
3

One sketch, four protocols

This sketch is the rig for this blueprint AND the next one, and that is deliberate: only the MODE constant changes between them, so any difference you measure is the protocol and nothing else. Set MODE to MODE_ALOHA_PURE on all four boards and sweep OFFER_PCT from 5 to 100, recording delivered against sent at each point. Then set MODE_ALOHA_SLOTTED, feed the slot clock from the monitor board, and sweep again. Keep both curves. Blueprint 8 changes one line and beats them.
shared_medium.inocpp
// ONE sketch, four protocols. This is the rig for blueprints 7 and 8, and the point is
// that ONLY the MODE constant changes between them -- same hardware, same frames, same
// backoff, so the throughput differences are the protocols and nothing else.
//
//   MODE_ALOHA_PURE     transmit whenever ready.                    expect ~18 %
//   MODE_ALOHA_SLOTTED  transmit only on a slot boundary.           expect ~37 %
//   MODE_CSMA           wait for the channel to go idle first.      expect much more
//   MODE_CSMA_CD        also listen WHILE sending, and abort.       expect more again
//
// Wiring: every station drives SHARED open-drain (output LOW, or input to release) with
// a single 4k7 pull-up on the whole bus. Anyone may pull it low; nobody can force it
// high. That is what makes two simultaneous transmitters produce garbage.
//   GPIO4  = SHARED bus       GPIO5 = slot clock in (slotted modes)
//   Set STATION to 0,1,2,3 on the four boards.

#define MODE_ALOHA_PURE     0
#define MODE_ALOHA_SLOTTED  1
#define MODE_CSMA           2
#define MODE_CSMA_CD        3

const int MODE    = MODE_ALOHA_PURE;   // <-- the only line that changes
const int STATION = 0;                 // <-- 0..3, different on each board

const int PIN_BUS  = 4;
const int PIN_SLOT = 5;

const unsigned BIT_US    = 200;        // one bit time
const int      FRAME_BITS = 40;        // 5 bytes
const unsigned SLOT_US   = BIT_US * FRAME_BITS;

inline void busDrive(int level) {
  if (level) pinMode(PIN_BUS, INPUT);          // release: the pull-up takes it high
  else       { pinMode(PIN_BUS, OUTPUT); digitalWrite(PIN_BUS, LOW); }
}
inline int busRead() { return digitalRead(PIN_BUS); }
inline bool busIdle() { pinMode(PIN_BUS, INPUT); return digitalRead(PIN_BUS) == HIGH; }

unsigned long sent = 0, delivered = 0, collisions = 0;

// Send one frame. Returns false if CSMA/CD detected a collision and aborted.
bool sendFrame(uint8_t *frame, int n) {
  for (int i = 0; i < n; i++) {
    for (int b = 7; b >= 0; b--) {
      int bit = (frame[i] >> b) & 1;
      busDrive(bit);
      delayMicroseconds(BIT_US / 2);
      if (MODE == MODE_CSMA_CD && busRead() != bit) {
        // What we hear is not what we are driving: somebody else is on the bus.
        busDrive(0);                              // JAM, so everyone agrees
        delayMicroseconds(BIT_US * 4);
        busDrive(1);
        collisions++;
        return false;                             // abort NOW, not at the end of the frame
      }
      delayMicroseconds(BIT_US / 2);
    }
  }
  busDrive(1);
  return true;
}

void waitSlot() {
  while (digitalRead(PIN_SLOT) == LOW)  ;
  while (digitalRead(PIN_SLOT) == HIGH) ;         // falling edge = slot boundary
}

void setup() {
  Serial.begin(115200);
  delay(300);
  pinMode(PIN_BUS, INPUT);
  pinMode(PIN_SLOT, INPUT_PULLUP);
  randomSeed(STATION * 7919 + micros());
  Serial.printf("# station %d, mode %d\n", STATION, MODE);
  Serial.println("# offered,delivered,collisions  -- sweep OFFER_PCT and plot the pair");
}

const int OFFER_PCT = 30;              // <-- sweep this from 5 to 100 and record each point

void loop() {
  static int tries = 0;
  if ((int)random(100) >= OFFER_PCT) { delayMicroseconds(SLOT_US); return; }

  uint8_t frame[5] = {0xAA, (uint8_t)STATION, (uint8_t)(sent & 0xFF), 0x00, 0x00};

  if (MODE >= MODE_CSMA)
    while (!busIdle()) ;                          // CARRIER SENSE: the one added line

  if (MODE == MODE_ALOHA_SLOTTED) waitSlot();

  sent++;
  bool ok = sendFrame(frame, 5);

  // Success is judged by the monitor station pulling the bus low as an acknowledgement
  // within one slot. No acknowledgement means the frame was destroyed.
  if (ok) {
    unsigned long t0 = micros();
    bool ack = false;
    while (micros() - t0 < SLOT_US) if (busRead() == LOW) { ack = true; break; }
    if (ack) { delivered++; tries = 0; }
    else     { collisions++; ok = false; }
  }

  if (!ok) {                                       // BINARY EXPONENTIAL BACKOFF
    tries++;
    unsigned long slots = random(0, 1L << (tries > 10 ? 10 : tries));
    delayMicroseconds(SLOT_US * slots);
  }

  if (sent % 200 == 0)
    Serial.printf("%lu,%lu,%lu\n", sent, delivered, collisions);
}

Vifaa kwa hatua hii:

Resistor KitResistor Kit1 kipande
LED AssortmentLED Assortment1 kipande
Jumper Wire SetJumper Wire Set1 kipande

Zana zinazohitajika:

ESP32 Development BoardESP32 Development Board
Breadboard - ClassicBreadboard - Classic
Digital OscilloscopeDigital Oscilloscope
Desktop ComputerDesktop Computer
4

The two curves, and what backoff is for

Inapakia daftari la Jupyter…

Zana zinazohitajika:

Desktop ComputerDesktop Computer
5

Compendium: the value of no coordination

WHY EIGHTEEN PERCENT WAS A BARGAIN. The alternative in 1971 was polling or a fixed assignment: give each terminal a guaranteed slice. With a hundred terminals of which three are active, fixed assignment gives each one percent of the channel and wastes ninety-seven. ALOHA gives the active ones eighteen percent BETWEEN THEM, with no master station, no schedule, and no way for the network to break when a terminal is switched off. Random access wins whenever the population is large and the duty cycle is small — which is the same condition that made packet switching win two blueprints ago. WHERE IT WENT. ALOHA is not a historical curiosity: it is the direct ancestor of every shared radio channel since. GSM and LTE use slotted ALOHA for the random-access channel a handset uses to ask for a scheduled allocation. WiFi's CSMA/CA is ALOHA with listening added and collision DETECTION removed, because a radio still cannot hear while it transmits. Satellite terminals, RFID readers and LoRaWAN all do a version of it. The eighteen percent was never the point — the absence of a scheduler was. THE SIBLING, AND THE MEASUREMENT. Pure ALOHA, 18.4 %: no coordination whatever. Slotted, 36.8 %: one shared clock. CSMA/CD, above 90 %: stations that can hear the channel before and while they speak. Each step buys throughput with a stronger assumption about what a station can sense, and blueprint 8 pays the last one on the rig you have already built.

Vifaa

4

Zana Zinazohitajika

6
Jumla inayokadiriwa
Kile mtengenezaji alinunua. Malighafi zisizo na bei hupatikana pale unaponunua.
$1.21

CC0 Umma Wote

Mchoro huu umetolewa chini ya CC0. Uko huru kunakili, kubadilisha, kusambaza, na kutumia kazi hii kwa madhumuni yoyote, bila kuomba ruhusa.

Saidia Mtengenezaji kwa kununua bidhaa kupitia Mchoro wao ambapo wanapata Kamisheni ya Mtengenezaji iliyowekwa na Wachuuzi, au unda marudio mapya ya Mchoro huu na uiunganishe kama kiungo katika Mchoro wako kuchangia mapato.

Majadiliano

(0)

Ingia kujiunga na majadiliano

Inapakia maoni...