Hi, this isn't a typo, just a suggestion so feel free to close if this is not the right place for it.
In chapter 9 Scheduling: Proportional Share, section 9.2 Ticket Mechanisms, the code in Figure 9.1: Lottery Scheduling Decision Code does not make it obvious that getrandom(0, totaltickets) should return a value between 0 (inclusive) and totaltickets (exclusive).
This is alluded to in section 9.1 ("The scheduler then picks a winning ticket, which is a number from 0 to 99"), but it would be helpful to clarify this in the code as well. Perhaps update the code comment to:
// winner: use some call to a random number generator to get a value, between 0 and the total # of tickets minus 1
Hi, this isn't a typo, just a suggestion so feel free to close if this is not the right place for it.
In chapter 9 Scheduling: Proportional Share, section 9.2 Ticket Mechanisms, the code in Figure 9.1: Lottery Scheduling Decision Code does not make it obvious that
getrandom(0, totaltickets)
should return a value between 0 (inclusive) andtotaltickets
(exclusive).This is alluded to in section 9.1 ("The scheduler then picks a winning ticket, which is a number from 0 to 99"), but it would be helpful to clarify this in the code as well. Perhaps update the code comment to: