gpt4 book ai didi

linux - rq->cfs.load 值在 Linux 内核中到底代表什么?

转载 作者:太空宇宙 更新时间:2023-11-04 04:04:26 25 4
gpt4 key购买 nike

我是 Linux 内核新手。我正在阅读有关 Linux 的 CFS 调度程序的内容

https://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt

我遇到了几行

运行队列中正在运行的任务总数通过rq->cfs.load值,即该节点上排队的任务权重之和运行队列。

现在,如果 rq->cfs.load 告诉可运行进程的总数,那么它应该是这样的数字:
3 -> 3 个进程可运行
5 -> 5 个进程可运行

但是rq->cfs.load的实际值是进程权重的总和。

我的问题是:

  1. 加权和如何得知可运行进程的数量?
  2. 这里所说的进程权重是什么意思?

最佳答案

我还是 Linux 的初学者。但据我了解,这意味着

1.I think you got a bit confused: Whenever the number of process increase(its a change) , some scheduling parameters needs to be changed. The scheduling class functions rather than counting the number of process, it uses it's load value to calculate its parameters. So the change(i.e. increase in the number of processes) is accounted ( i.e. taken into consideration) to calculate the load value through cfs_rq->load variable. And we do this updation of cfs_rq->load by summing the weight of the process.

<小时/>

2. weight of process: Weight of process is calculated through its dynamic priority. How is Dynamic Prority calculated? Dynamic Priority calculation : Static priority + "scheduling class of the process to be scheduled"(i.e. real-time vs Normal) are used to calculate Dynamic priority. The calculation is not simple addition. Read this Link from UTLK . Read some link for static priorities as well.

关于linux - rq->cfs.load 值在 Linux 内核中到底代表什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21806541/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com