remzi-arpacidusseau / ostep-typos

51 stars 44 forks source link

Suggestion: clarify that lottery scheduler picks random ticket in range [0, n) in chapter 9 section 2 #82

Closed legate closed 1 year ago

legate commented 1 year ago

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

remzi-arpacidusseau commented 1 year ago

Thanks! Fixed.