deepak525 / Lottery-Scheduling

Lottery scheduling is a probabilistic scheduling algorithm for processes in an operating system. Processes are each assigned some number of lottery tickets, and the scheduler draws a random ticket to select the next process

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lottery-Scheduling

Problem:

In the problem we have to assign one or more lottery tickets to each of the process. A lottery ticket is chosen at random, and the process holding that ticket gets the CPU. The BTV operating system implements lottery scheduling by holding a lottery 50 times each second, with each lottery winner getting 20 milliseconds of CPU time (20 milliseconds × 50 = 1 second)

Solution:

According to the problem, first we allocate Burst time and Priority for each process. One or more lottery ticket is assigned to each of the process. Assign more tickets to the higher priority process. The probability of completion of process with more number of tickets increases. Random ticket is generated and process having the ticket gets the CPU for the specified quantum time. After the quantum time, the running process is preempted and another random ticket is generated. Now the process with the ticket gets the CPU. This process will continue until all the processes are completed.

Main Concept:

Give more lottery ticket to the higher priority process.

About

Lottery scheduling is a probabilistic scheduling algorithm for processes in an operating system. Processes are each assigned some number of lottery tickets, and the scheduler draws a random ticket to select the next process


Languages

Language:C 100.0%