Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Overview  





2 About O(1) notation  





3 Improvement in Linux scheduler performance  





4 Issues  





5 Replacement  





6 See also  





7 References  





8 External links  














O(1) scheduler






Deutsch

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


Location of the "O(1) scheduler" (aprocess scheduler) in a simplified structure of the Linux kernel.

AnO(1) scheduler (pronounced "O of 1 scheduler", "Big O of 1 scheduler", or "constant time scheduler") is a kernel scheduling design that can schedule processes within a constant amount of time, regardless of how many processes are running on the operating system. This is an improvement over previously used O(n) schedulers, which schedule processes in an amount of time that scales linearly based on the amounts of inputs.

In the realm of real-time operating systems, deterministic execution is key, and an O(1) scheduler is able to provide scheduling services with a fixed upper-bound on execution times.

The O(1) scheduler was used in Linux releases 2.6.0 thru 2.6.22 (2003-2007), at which point it was superseded by the Completely Fair Scheduler.

Overview

[edit]

The Linux scheduler was overhauled completely with the release of kernel 2.6 in 2003.[1][2] The new scheduler was called the O(1) scheduler. The algorithm used by the O(1) scheduler relies on active and expired arrays of processes to achieve constant scheduling time. Each process is given a fixed time quantum, after which it is preempted and moved to the expired array. Once all the tasks from the active array have exhausted their time quantum and have been moved to the expired array, an array switch takes place. Because the arrays are accessed only via pointer, switching them is as fast as swapping two pointers.[3] This switch makes the active array the new empty expired array, while the expired array becomes the active array.

About O(1) notation

[edit]

Analgorithm operates over an input, and the size of that input usually determines its running time. Big O notation is used to denote the growth rate of an algorithm's execution time based on the amount of input. For example, the running time of an O(n) algorithm increases linearly as the input size n grows.[4] The running time of an O(n2) algorithm grows quadratically. If it is possible to establish a constant upper bound on the running time of an algorithm, it is considered to be O(1) (one might say it runs in "constant time"). That is, an O(1) algorithm is guaranteed to complete in a certain amount of time regardless of the size of the input.[5]

Improvement in Linux scheduler performance

[edit]

The Linux 2.6.8.1 scheduler did not contain any algorithms that run in worse than O(1) time.[6] That is, every part of the scheduler is guaranteed to execute within a certain constant amount of time regardless of how many tasks are on the system. This allows the Linux kernel to efficiently handle massive numbers of tasks without increasing overhead costs as the number of tasks grows. There are two key data structures in the Linux 2.6.8.1 scheduler that allow for it to perform its duties in O(1) time, and its design revolves around them: runqueues and priority arrays.

Issues

[edit]

The main issue with this algorithm is the complex heuristics used to mark a task as interactive or non-interactive. The algorithm tries to identify interactive processes by analyzing average sleep time (the amount of time the process spends waiting for input). Processes that sleep for long periods of time probably are waiting for user input, so the scheduler assumes they're interactive. The scheduler gives a priority bonus to interactive tasks (for better throughput) while penalizing non-interactive tasks by lowering their priorities. All the calculations to determine the interactivity of tasks are complex and subject to potential miscalculations,[citation needed] causing non-interactive behavior from an interactive process.

Replacement

[edit]

In 2.6.23 (October 2007), the Completely Fair Scheduler was introduced, replacing the O(1) Scheduler. According to Ingo Molnar, the author of the CFS, its core design can be summed up in single sentence: "CFS basically models an 'ideal, precise multitasking CPU' on real hardware."[7]

See also

[edit]

References

[edit]
  1. ^ "Introducing the 2.6 Kernel | Linux Journal". www.linuxjournal.com. Retrieved 2019-07-19.
  • ^ Chandandeep Singh Pabla (August 1, 2009). "Completely Fair Scheduler". linux journal. Retrieved 2014-09-09.
  • ^ Robert Love. "The Linux Process Scheduler". Retrieved 2014-09-09.
  • ^ dws. "An informal introduction to O(N) notation". Retrieved 2014-09-09.
  • ^ Rob Bell. "A Beginner's Guide to Big O Notation". Retrieved 2014-09-09.
  • ^ Josh Aas. "Understanding the Linux 2.6.8.1 CPU Scheduler" (PDF). GitHub. Retrieved 2014-09-09.
  • ^ <mingo@elte.hu>, Ingo Molnar. "Linux-Kernel Archive: Re: fair clock use in CFS". lkml.iu.edu. Retrieved 2018-08-30.
  • [edit]
    Retrieved from "https://en.wikipedia.org/w/index.php?title=O(1)_scheduler&oldid=1153621353"

    Category: 
    Linux kernel process schedulers
    Hidden categories: 
    Articles with short description
    Short description matches Wikidata
    All articles with unsourced statements
    Articles with unsourced statements from July 2016
    Webarchive template wayback links
     



    This page was last edited on 7 May 2023, at 11:06 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki