We all hope that when scheduling tasks, tasks are carried out in the same proportion of progress, so that it is fair, no one will do more, no one will do a lot. For example, A completed 50%, and B should also complete 50%. This percentage of completion is actually the "actual allocated time/should be allocated".
In the case of weighting, the tasks are performed at the same time according to the weighted proportion, for example, the weight of A process is 2, the weight of B process is 1, A process is 50% completed, and B process should be completed 25%. The actual allocated time after weighting = (total scheduling time * The process weight) / total weight
Then we can get the formula
The actual allocation time of A process / B should allocate time = (Total scheduled time * A process weight) / (Total weight * A process should be allocated time)
The actual allocation time of B process/B should allocate time = (Total scheduled time * B process weight) / (Total weight * B process should be allocated time)
If it is fair, the two are as equal as possible. Assuming that the above two equations are equal, we can get
(Time allocated by process A*G)/(Weight of process A)=(Time allocated by process B*G)/(Weight of process B)
G is a constant
Is the calculation method of the virtual clock of the Linux CFs scheduler like:
Virtime = the time allocated by the process * NICE_0_LOAD / the weight of the current process
The above is my personal understanding, if it is wrong, please point it out, thank you