The lottery scheduling algorithm has a very different approach to scheduling processes. It works exactly as it sounds, each process in the ready state queue is given some lottery tickets, and then the algorithm picks a winner based on a randomly generated number.

The winning process is awarded a time slice, in which the process may be complete or the time slice may expire before the process completes. The winning process goes back into the ready queue, receives its tickets for the next lottery, and the cycle continues.

Although each process will receive at least one (1) ticket per lottery, processes that are expected to be shorter will receive more than one ticket, thereby increasing the chance they’ll be picked.

In this way, the lottery scheduler resembles SJF/SRTF, in that it gives priority to what it thinks will be shorter processes. However, it is fairer then SJF/SRTF, because it does give each process a chance (albeit a small chance) to be selected for a time slice. Starvation is therefore avoided in the lottery scheduler.

A major drawback of the lottery scheduling algorithm is that it is inherently unpredictable. Due to the random nature of the scheduler, there is no way for OS designers to know for sure what will happen in lottery scheduling, possibly producing undesirable results.