Example Analysis of process scheduling Strategy in Linux
Editor to share with you the Linux process scheduling strategy example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!
1. Under Linux, processes are divided into five categories, namely, stop class, cut-off class, real-time class, fair class and idle class.
Each category has a run queue, and each time it is scheduled, it is sorted according to the priority of the category, and then scheduled to run according to the highest priority task within each category.
File: core.c (linux-4.6\ kernel\ sched)
Interpretation: take a look at the for loop below, and you can see that the idea is to iterate through each category and select the next runnable task. Since most of the tasks are in the fair queue, in most cases, the choice is made in the fair queue, so the kernel developer added likely () to the above code to improve performance.
2. The calling order of the scheduler schedule ().
Schedule ()-- > _ _ schedule ()-> pick_next_task ()
File: core.c (linux-4.6\ kernel\ sched)
. (omitted in the middle)
The above is all the contents of the article "sample Analysis of process scheduling policies in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!