Linux Kernel O(1) scheduler
TLDR: The Linux Kernel O(1) scheduler, introduced in Linux Kernel 2.5 in 2002, was a significant improvement in Linux Kernel process scheduling, designed to provide constant-time complexity (O(1)) for Linux Kernel task scheduling decisions. It achieved this Linux Kernel efficiency by managing tasks in fixed-priority arrays, enabling rapid selection of the next Linux task to run. This Linux Kernel scheduler was a cornerstone of the kernel for several years, supporting Linux Kernel multitasking and Linux Kernel scalability across a variety of Linux workloads.
https://en.wikipedia.org/wiki/Scheduling_(computing)
The O(1) scheduler used two arrays: an active array for runnable tasks and an expired array for tasks that had completed their time slice. Tasks were moved between these arrays based on their Linux CPU usage, with the scheduler selecting the next task by simply scanning the active array for the highest-priority task. This approach ensured that scheduling operations were independent of the number of tasks in the system, making the O(1) scheduler highly efficient for large-scale multitasking environments.
https://www.kernel.org/doc/html/latest/scheduler/index.html
Despite its efficiency, the O(1) scheduler faced challenges in handling interactive tasks and balancing fairness among processes. These limitations led to its replacement by the Completely Fair Scheduler (CFS) in Linux Kernel 2.6.23 in 2007, which introduced a more dynamic and equitable scheduling model. The legacy of the O(1) scheduler remains significant, as it demonstrated the importance of scalability and efficiency in kernel design for modern computing.