freecoding.school100% FREE · NO SIGNUP
The Seven LayersISSUE #64 of 73

fan-out / fan-in · parallel spawn · quorum fuse

OMNIVSThe Silent Failure
OMNI saysFan-out spawns many workers in parallel on one goal; fan-in fuses their PRESENTed signals back into a single result by quorum.

The orchestra's core move is fission then fusion (mol-16). Fan-out is fission: split a goal into independent sub-tasks and spawn one worker per task, all running in parallel. Fan-in is fusion: collect each worker's PRESENTed signal and merge them into one answer. The merge is rarely "take the first" — it is usually a quorum (majority agree), a reducer (sum, concat, max), or a ranker (pick the highest confidence). The conductor decides the merge rule up front, before any worker reports.

Parallelism is the payoff and the trap. Fan-out only helps when sub-tasks are genuinely independent — if worker B needs worker A's output, that is a pipeline, not a fan-out, and you should chain packets via next instead. Fan-in must also be tolerant: some workers will fail or time out, so the fuse rule needs a quorum threshold (three of five is enough) rather than waiting forever for all of them.

Power-ups you unlock

The Silent Failure attacks — common mistakes

Boss battleBuild a fan-out that spawns five workers on one goal and a fan-in that returns CONFIRMED as soon as three of them PRESENT agreement, without waiting for the slow two.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#b388ff;font-family:monospace;padding:20px"><pre id="o"></pre>
<script>
const be = (layer, verb, payload) => ({ layer, verb, payload });
function spawnWorker(role){
  return { role, latency: Math.floor(Math.random()*100), vote: Math.random() > 0.3 };
}
function orchestrate(goal, roles, quorum){
  const log = ['fan-out: spawned ' + roles.length + ' workers on "' + goal + '"'];
  // fan-out, sorted so the earliest-to-report come first
  const workers = roles.map(spawnWorker).sort((a,b)=> a.latency - b.latency);
  // fan-in: count votes as they arrive, stop the moment quorum is met
  let yes = 0, seen = 0;
  for(const w of workers){
    seen++;
    if(w.vote) yes++;
    log.push('  ' + w.role + ' reported (t=' + w.latency + 'ms) ' + (w.vote ? '[ok]' : '[fail]'));
    if(yes >= quorum){
      log.push('quorum ' + quorum + ' met after ' + seen + '/' + roles.length + ' → CONFIRMED (slow workers PRUNEd)');
      return log.join('\n');
    }
  }
  log.push('no quorum: ' + yes + '/' + quorum + ' → REJECTED');
  return log.join('\n');
}
document.getElementById('o').textContent =
  orchestrate('ship the feature', ['scout','builder','risk','qa','docs'], 3);
</script></body></html>
▶ Open the interactive comic issue
‹ The Spawn Contract · What A Parent Hands A ChildApoptosis · Programmed Agent Death · PRUNE On Done ›