| ISSUE 121/456 · COMPUTER SCIENCE |
~4 MIN |
FOUNDATION / CS · DEPENDENCY ORDERING · READING DATE 2027-01-30 · JANUARY 2027 — MOTION AND COMPUTING FOUNDATIONS
How software puts prerequisites before the job
START HERE
You cannot publish a finished page before the chart and caption needed to assemble it are ready. A topological order is an arrangement of tasks that places every prerequisite before the task depending on it. It handles “must happen before” relationships without pretending that every pair of tasks needs a fixed order.
|
/ WHY NOW
This helps make sense of a build tool’s schedule or an installer waiting for another package. Some jobs can be swapped or run together, while a genuine dependency cannot be bypassed by choosing a different alphabetical order.
|
/ THE IDEA
Represent tasks as points and prerequisites as directed connections. An arrow A→C means A must finish before C starts. A task’s incoming count records how many prerequisites remain unfinished. Start by selecting tasks with count zero: nothing in this model is still blocking them. After finishing one of those tasks, reduce the counts of tasks directly depending on it. Newly zero counts become ready. Repeating this process creates a valid order if the dependency graph has no directed cycle, a chain of arrows returning to where it began. Multiple ready tasks mean multiple valid orders may exist.
THE FORMAL IDEA
ready = tasks with zero unfinished prerequisites
| An incoming count counts requirements, not seconds of running time. | | When task u finishes, decrement the count for every task connected by an outgoing arrow from u. A count reaching zero makes that task eligible, not automatically completed. |
|
RUN THE TINY EXAMPLE
Change one thing. Predict what happens.
Toy publishing jobs: A = export chart; B = write caption; C = assemble page; D = publish. Dependencies: A→C, B→C, C→D. Initial counts: A 0, B 0, C 2, D 1. One valid order is A, B, C, D; B, A, C, D is equally valid. Change only one requirement by adding D→A. Now B can finish, but A, C and D remain blocked in a cycle.
|
The changed graph asks for publication before exporting the chart, while publication already needs a page containing that chart. Waiting longer does not resolve that contradiction. A diagnostic should report the cycle or blocked dependencies, rather than invent an order that violates one of the requirements.
/ SO WHAT?
This is not a claim that the first valid order finishes fastest. If A takes much longer than B, running them simultaneously could help, but that also depends on available workers and resources. Topological ordering answers legality; scheduling adds time, capacity and policy to choose among legal possibilities.
ONE CAVEAT |
| The model assumes the listed prerequisites are complete and accurately directed. Some real systems handle dependency cycles through special joint-processing rules, but a strict before-start order cannot satisfy a directed cycle. |
KEEP THIS
Release tasks when their last prerequisite finishes; if unfinished tasks form a cycle, no amount of reordering can satisfy those strict requirements.
|
NEXT: Why a soap film tries to shrink
|