(IJCSIS) International Journal of Computer Science and Information Security,Vol. 8, No. 7, October 2010
calculated and assigned to each process. On the basis of thattime quantum, processes are executed one after another. If time quantum expires, CPU is taken from the processesforcefully and assigned to the next process; the preemptedprocesses are put at the end of the ready queue [7].SJRR is provides fair share to each process and is useful intime sharing systems. It provides minimum average time andaverage turnaround time [7]. The problem with this algorithmis that if calculated time quantum is too small then there isoverhead of more context switches.III.
P
ROPOSED
S
CHEDULING
A
LGORITHM
In this algorithm, a new factor F is calculated that isaddition of two basic factors (arrival time and burst time of theprocesses). Here is the equation that shows this relation:F= Arrival Time + Burst TimeThis factor F is assigned to each process and on the basisof this factor processes are arranged in ascending order in theready queue. Processes having highest value of the factor areexecuted first and those with lowest value of the factor areexecuted next. Depend on this new factor CPU executes theprocess that:
•
Has shortest burst time
•
Submit to the system at startProposed CPU scheduling algorithm reduces waiting time,turnaround time and response time and also increases CPUutilization and throughput. It has resolved the problem of starvation at much more extent and there is no problem of context switching in this algorithm.The working of the proposed algorithm is as given below:1.
Take list of processes, their burst time and arrivaltime.2.
Find the factor F by adding arrival time and bursttime of processes.3.
On the basis of factor, arrange processes and theirrelative burst time in ascending order using anysorting technique.4.
Calculate waiting time of each process.5.
Iterate through the list of processesa.
Add total waiting time with waiting time of each process to find total waiting timeb.
Add burst time and waiting time of eachprocess to find turnaround timec.
Add total turnaround time and turnaround timeof each process to find total turnaround time6.
Average waiting time is calculated by diving totalwaiting time with total number of processes.7.
Average turnaround time is calculated by dividingtotal turnaround time with total number of processes.IV.
P
SEUDO
C
ODE
f
0temp
0total_tatime
0.0tw_time
0.0avg_wt
0.0avg_tatime
0.0For i
0 to processF[i]
atime[i] + btime[i]For i
process-1 to 0For j
1 to processIF F [j-1] > F[j]f
F[j-1]F [j-1]
F[j]F [j]
f temp
btime[j-1]btime[j-1]
btime[j]btime[j]
tempptemp
proname[j-1]proname[j-1]
proname [j]proname[j]
ptempwtime [1]
0For j
1 to countwtime[j]
btime [j-1] + wtime [j-1]For j
0 to processtw_time
tw_time + wtime[j]tatime[j]
b[j] + wtime[j]total_ tatime
total_tatime+ tatime[j]avg_wt
tw_time / processavg_tatime
total_tatime/ process
V.
E
XPERIMENTAL
E
VALUATION
&
R
ESULTS
To explain the performance of proposed schedulingalgorithm and to compare its performance with theperformance of existing algorithms; consider the following setof processes along with their burst time, arrival time inmilliseconds and priority in numbers as shown in the Table 1:
Process
Name
Arrival
Time
Burst
Time
Priority
P1
0
20
6
P2
1
10
8
P3
2
3
2
P4
3
13
1
P5
4
10
4
Table 1: Set of Processes
41http://sites.google.com/site/ijcsis/ISSN 1947-5500