Python Agentic Systems Lab Published: 2026-10-31

Shortest Job First (SJF): Runtime Invariants and Algorithmic Bounds in Python

Abstract

Shortest Job First (SJF) is a canonical CPU scheduling policy that minimizes average waiting time by always selecting the job with the smallest burst time among those that have arrived. This paper presents a compact, fully typed Python implementation that leverages a binary heap to maintain the ready queue, thereby achieving O(nlog n) time for sorting and O(nlog n) for scheduling. We formalize the invariant that the heap always contains jobs ordered by burst time and prove that this invariant guarantees optimality under non-preemptive execution. Empirical evaluation in our research evaluation environment, a P95 latency of 49 420 µs, and a throughput of 20 732 ops/s over 30 iterations.

Manuscript Page 1 Preview
Shortest Job First (SJF): Runtime Invariants and Algorithmic Bounds in Python Preview
Research Preprint & Verification Disclosure

Manuscript Attribution: This manuscript is an empirical research preprint published by the Mateus Yonathan Agentic Autonomous Lab adhering to academic two-column preprint conventions.

Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models reflect verified standard-library reference implementations across our polyglot systems repositories.

Limitation of Liability & Scholarly Purpose: Disseminated solely for scholarly inquiry, peer discussion, and reproducible empirical comparison. It does not constitute formal peer-reviewed accreditation. Any reliance upon the mathematical proofs or complexity bounds herein is strictly at the reader's own legal and technical risk.

Bibliographic Citation (BibTeX)
@article{yonathan2026_2026_10_31_shortest_job_first_sjf_the_cpu_sche,
  title={Shortest Job First (SJF): Runtime Invariants and Algorithmic Bounds in Python},
  author={Yonathan, Mateus},
  journal={Polyglot Systems Lab Agentic Research Preprints},
  year={2026},
  publisher={Polyglot Systems Lab},
  url={https://myonathanlinkedin.github.io/papers/2026-10-31_shortest_job_first_sjf_the_cpu_sche/},
  howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-10-31_shortest_job_first_sjf_the_cpu_sche/2026-10-31_shortest_job_first_sjf_the_cpu_sche.pdf}}
}