> counter = (counter >> 1) + priority ... Note that counter >> 1 is a faster way to divide by 2 ... This means that if a task is waiting for I/O for a long time, and its priority is higher than 2, counter value will monotonically increase when counter is updated.
Actually the effect is that counter will exponentially decay up to 2 * priority (if the task is not runnable). You can sanity check this by looking at the limit: if counter is 2*priority then that expression will leave it at its current value.
Actually the effect is that counter will exponentially decay up to 2 * priority (if the task is not runnable). You can sanity check this by looking at the limit: if counter is 2*priority then that expression will leave it at its current value.