How are dynamic thread priorities calculated in Linux 2.6.x?

A thread (or task) will lose dynamic priority using a large number of CPUs and gain priority using a smaller number of CPUs. How exactly are these priorities calculated for n threads (using the usual SCHED_OTHER scheduling policy)?

+6
source share
1 answer

Quote from this

Linux Scheduler 2.6.8.1 rewards I / O related tasks and penalizes CPU related tasks by adding or subtracting priority from static tasks. The adjusted priority is called the dynamic priority of tasks, and is accessible through the variable prio of tasks (for example, p-> prio, where p is the task). If the task is interactive (the term of the scheduler for I / O is related), its priority is increased. If this is a fighter with a processor, he will receive a fine. In Linux scheduler 2.6.8.1, the maximum priority bonus is 5, and the maximum penalty is 5. Since the scheduler uses bonuses and penalties, the static task priority adjustment is respected. A soft processor bot with a good value of -2 can have a dynamic priority of 0, the same as a task that is neither a CPU nor an I / O hog.

I think this is a fair explanation. The priority is calculated based on whether it is a thread associated with the CPU or its associated I / O. As for what you talked about in the question, gain priority by using less of CPU more likely to receive priority by being interactive (I / O binding). I hope this passage answers your request ...

+1
source

Source: https://habr.com/ru/post/974567/


All Articles