You are on page 1of 11

Simulation of process scheduling algorithm

Using Poisson Distribution Function

Algorithm to Compare
1. Shortest Job First Non-Preemptive Scheduling algorithm
2. Highest Response-Ratio-Next (HRRN) Scheduling algorithm
3. Dynamic Round-Robin even-odd number quantum Scheduling
algorithm
Parameter Range
600-800
JOSHUA ALEX MBAYA
P18PSCS8037
POISSON DISTRIBUTION
The Poisson distribution is the discrete probability
distribution of the number of events occurring in a given
time period, given the average number of times the event
occurs over that time period.
Poisson distribution can be used to distribute
 The arrival of an event/process
 The waiting time between events/process
 The service/burst time of a event/process etc.

2
POISSON DISTRIBUTION FORMULA
JAVA CODE
private static int poisson(double mean) {
Random random=new Random();
int r = 0;
double a = random.nextDouble();
double p = Math.exp(-mean);

while (a > p) {
r++;
a = a - p;
p = p * mean / r;
}
return r;
}
}

3
Shortest Job First Non-Preemptive
Scheduling Algorithm
Also Known as Shortest Process Next (SPN), is a scheduling policy
that selects for execution the waiting process with the smallest
execution time. SJN is a non-preemptive algorithm.
Shortest job next is advantageous because of its simplicity and
because it minimizes the average amount of time each process has to
wait until its execution is complete.
The disadvantage of using shortest job next is that the total
execution time of a job must be known before execution. While it is
impossible to predict execution time perfectly, several methods can
be used to estimate it, such as a weighted average of previous
execution times.
4
Highest Response Ratio Next (HRRN)
CPU Scheduling Algorithm
The name itself states that we need to find the response ratio of all
available processes and select the one with the highest Response
Ratio. A process once selected will run till completion.
Criteria – Response Ratio
Mode – Non-Preemptive
Response Ratio = (W + S)/S
Here, W is the waiting time of the process so far and S is the Burst
time of the process.
Performance of HRRN –
1. Shorter Processes are favored.
2. Aging without service increases ratio, longer jobs can get past
shorter jobs. 5
Dynamic Round-Robin Even-Odd Number Quantum
Scheduling Algorithm
Round robin scheduling is the preemptive scheduling in which every
process get executed in a cyclic way, i.e. in this a particular time slice
is allotted to each process which is known as time quantum. Every
process, which is present in the queue for processing, CPU is
assigned to that process for that time quantum. Now, if the execution
of the process gets completed in that time quantum, then the
process will get terminate otherwise the process will again go to the
ready queue, and the previous process will wait for the turn to
complete its execution.

6
Method For Even-Odd Time Quantum

In this strategy we calculate two time quantum’s TQ1 and TQ2.


Where TQ1 is the average burst time of all the processes at even
places in the ready queue and TQ2 is the average burst time of all the
processes at odd places in the ready queue. Then we compare the
two time quantum’s, to get the greater Time Quantum. Take greater
time as a time quantum and apply to the each process.

7
ANALYSIS
On the basis of the above outcome for HRRN, RR and SJF based priority scheduling
algorithm, the average waiting and average turnaround time is calculated which is shown
in graph. Comparison of average waiting time and turnaround time for 10 processes.

8
Conclusion

After analyzing the three scheduling algorithm (SJN, RR and HRRN), I


found that the waiting time and turnaround time of HRRN is
minimum compared to Shortest Job Next and Highest Response
Ratio Next scheduling algorithm.

9
REFERENCES

Arpaci-Dusseau, Remzi H.; Arpaci-Dusseau, Andrea C. (2014), Operating


Systems: Three Easy Pieces [Chapter Scheduling Introduction]
(PDF), Arpaci-Dusseau Books
Tanenbaum, A. S. (2008). Modern Operating Systems (3rd ed.). Pearson
Education, Inc. p. 156. ISBN 0-13-600663-9.
Silberschatz, A.; Galvin, P.B.; Gagne, G. (2005). Operating Systems

14
13
12
Concepts (7th ed.). Wiley. p. 161. ISBN 0-471-69466-5.
Reinertsen, Donald (2008). Principles of Product Development Flow:
Second Generation Lean Product Development. Celeritas
Publishing. p. 193. ISBN 978-1-935401-00-1.
Knesek, Doug. "'Value-Flow Rate': A Better Name for a Great Measure".
Retrieved April 8, 2016.

10
THANK
YOU FOR

14
13
12
LISTENING

11

You might also like