Part 2 of 7 · 1 min read
Shares
In plain words: A family sets a rule for the television: the older child gets 3 hours a week and the younger 1 hour. The rule says nothing about who watches first on any given evening. It says only how the total divides in the long run. The analogy stops in one place: a family can keep exact time with a clock, while a scheduler must keep the shares with many short turns.
Proportional-share scheduling (also called fair-share) gives each process a weight, and over time each process receives a fraction of the processor equal to its weight divided by the sum of the weights of all ready processes. With weights 3 and 1, the shares are 3 ÷ 4 = 75 per cent and 1 ÷ 4 = 25 per cent. When a process leaves, the shares of the others grow in the same proportion.
This differs from the earlier policies in what it promises. Priority scheduling promises order, and a high priority may take everything. Round robin treats everyone equally. Proportional share promises a ratio, so a low-weight process still gets its part and no process starves.
Proportional-share scheduling
Proportional-share scheduling is a policy that assigns each process a weight and aims to give it, over time, the fraction of processor time equal to its weight divided by the total weight of all ready processes.
Example: three ready processes with weights 100, 50 and 250 should get 25, 12.5 and 62.5 per cent of the processor.
Check yourself: 1. What are the shares for weights 2, 3 and 5? 2. What happens to the shares when one process leaves? 3. How does this differ from a priority?