ORIGINAL COMPANY-CONTEXT PRACTICE
Schedule a processor-toolchain build from its dependencies
Original practice scenario: A hypothetical compiler-toolchain build has modules with prerequisites and several parallel workers. Design a scheduler that detects cycles and produces explainable failures.
Written for independent practice using company context; this is not a verified question from a company interview.
A REASONED APPROACH
Model answer.
Represent the build as a dependency graph with immutable task inputs. Parallel execution is safe only when prerequisites are satisfied and task results can be identified and reused correctly.
Work through it
- Validate task identities and dependency references, compute indegrees and enqueue ready tasks; if no progress is possible while tasks remain, report a cycle or blocked dependency.
- Dispatch ready work within resource limits, decrement dependent counts only after successful completion, and retain failure causes for tasks that cannot start.
- Key cached outputs by toolchain, configuration and input fingerprints, testing disconnected components, repeated dependencies and deterministic output collection.
Tradeoffs to discuss
- Maximal parallelism reduces elapsed time but can exhaust memory or disk bandwidth; resource-aware scheduling may deliberately leave workers idle.
Common pitfalls
- Do not classify every blocked task as independently failed when one prerequisite caused the blockage.
- A cache hit is valid only for the declared inputs, not merely the same module name.