v4i7-0103

Download V4I7-0103

If you can't read please download the document

Upload: ganesh-arora

Post on 14-Nov-2015

214 views

Category:

Documents


1 download

DESCRIPTION

Improved Mean Round Robin with Shortest Job FirstScheduling

TRANSCRIPT

  • 2014, IJARCSSE All Rights Reserved Page | 170

    Volume 4, Issue 7, July 2014 ISSN: 2277 128X

    International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com

    Improved Mean Round Robin with Shortest Job First

    Scheduling Radhe Shyam

    Sunil Kumar Nandal

    Dept. of Computer Science and Engineering Dept. of Computer Science and Engineering

    GJUS&T, Hisar, GJUS&T, Hisar,

    Haryana, India Haryana, India

    Abstract One of the most important components of the computer resource is the CPU. CPU scheduling is the basis

    of operating systems. Scheduling is the technique used for controlling the order of job which is to be performed by a

    CPU of a computer. Some of the popular CPU scheduling algorithms are First-Come-First-Served (FCFS), Shortest

    Job First (SJF), Priority Scheduling and Round Robin (RR). Most CPU scheduling algorithms concentrate on

    maximizing CPU utilization and throughput and minimizing turnaround time, response time, waiting time, and

    number of context switching for a set of requests. In this paper, a new Round Robin Scheduling is designed. This

    Scheduling gives better result compare to Round Robin (RR), Improvent Round Robin (IRR), Enhanced Round Robin

    (ERR), Self Adjectment Round Robin (SARR), FCFS and some other scheduling algorithm.

    Keywords: Operating System, Scheduling, Round Robin algorithms, Waiting time, Turnaround time, Context switch.

    I . INTRODUCTION An Operating system is a software act as an intermediary between the user of a computer and computer hardware. The

    purpose of an O.S is to provide an environment in which a user can execute programs in efficient manner. An operating

    system provided functionality is memory management, file management, device management, CPU Scheduling, process

    management, protection and security.

    A. SCHEDULING: Scheduling is also a fundamental function of operating system. Almost all Computer devices and resources are scheduled

    before use. As CPU is one of the primary computer resources. Thus its scheduling is central to O.S designs. Scheduling is

    the strategy by which the system decides which task should be executed at any given time. Whenever the CPU became

    ideal the O.S must select one of the processes in the ready queue to be executed.

    B. SCHEDULING CRITERIA: CPU Utilization This is a measure of how much busy the CPU is. The proper use of CPU then the scientific developed

    technique is used. CPU utilization can range from 0 to 100 percent.

    Throughput- Throughput is the number of processes completed in how much per time period.

    For long processes this rate may be two processes per hour. For short transaction throughput might be 15 processes

    per second.

    Waiting time - Waiting time is the sum of periods spends waiting in the ready queue. CPU executes only one process at

    a time. The rest of processes wait for the CPU.

    Turnaround time - It is the total time taken to execute a process. The interval from the time of submission of a process to

    the time of completion is the turnaround time.

    Response time - Response time is the time from the submission of a request until the first response is produces.

    Context Switch A Context switch is process of storing and restoring context of a preempted job, so that execution can

    be resumed from same point at a later time of the job.

    C. Better CPU Scheduling criteria are following:

    Maximize Utilization and Throughput of the CPU.

    Minimize Turnaround Time, Response time, Waiting time and context Switch.

    D. Some Scheduling Algorithm: FCFS - FCFS is the simplest form of CPU scheduling algorithm. In this scheduling algorithm, the process that arrives

    first in ready queue served first, so the name First-Come-First-Served. The average waiting time in FCFS is quite long.

    SJF - In Shortest Job First (SJF) algorithm, process from the ready queue that has shortest CPU burst time will execute

    first. If two processes are having same CPU burst time and arrival time, then FCFS procedure is followed. In SJF average

    waiting time decreases.

    http://www.ijarcsse.com/
  • Shyam et al., International Journal of Advanced Research in Computer Science and Software Engineering 4(7),

    July - 2014, pp. 1-6

    2014, IJARCSSE All Rights Reserved Page | 171

    Priority - Priority scheduling algorithm allocates the CPU to the higher priority process from the ready queue.

    Round Robin - In Round Robin (RR), a small unit of time quantum is given to each process present in the ready queue

    which maintains the fairness factor.

    IRR - IRR picks the first job from the ready queue and allocate the CPU to it for a time interval of up to 1 time quantum.

    After completion of job time quantum, it checks the remaining CPU time of the currently running job. If the remaining

    CPU burst time of the currently running job is less than 1 time quantum, the CPU again allocated to the currently running

    job for remaining CPU burst time.

    ERR ERR picks the first job from the ready queue and allocate the CPU to it for a time interval of up to 1 time

    quantum. After completion of job time quantum, it checks the remaining CPU time of the currently running job. If the

    remaining CPU burst time of the currently running job is less than avg. of burst time divided by time quantum

    (avgburst/tq) value, then CPU again allocated to the currently running job for remaining CPU burst time.

    SARR In this algorithm the time quantum repeatedly adjusted according to the burst time of the now-running

    processes. In other words median burst time is used for time quantum value.

    TQBISA This algorithm is combination of two technique that are the following. First time quantum is median used,

    second ascending order burst time is executed in Round Robin algorithms.

    MMDRR - This algorithm is combination of two technique first is mean- derivation time quantum used, second

    ascending order burst time is executed in Round Robin algorithms.

    II . RELATED WORKS Related work done by the earlier authors in direction of the process scheduling and process management is described

    and explained here under.

    In Year 2012, Manish kumar Mishra [1] describes an improvement in RR. IRR picks the first job from the ready queue

    and allocate the CPU to it for a time interval of up to 1 time quantum. After completion of job time quantum, it checks

    the remaining CPU time of the currently running job. If the remaining CPU burst time of the currently running job is

    less than 1 time quantum, the CPU again allocated to the currently running process for remaining CPU time. In year

    2009, Rami J. Matarneh [2] performed a work Self-Adjustment-Round-Robin (SARR) based on a new approach called

    dynamic time quantum, in this approach the time quantum repeatedly adjusted according to the burst time of the now-

    running processes. In year 2011, Saroj Hiranwal [3] in which first of all arrange the processes according to the execution

    time/burst time in increasing order that is smallest the burst time higher the priority of the running process. The smart

    time slice is equal to the mid process burst time of all CPU burst time. In year 2011, H.S. Behera [4] proposes a newly

    improved process scheduling algorithm by using dynamic time quantum along with weighted mean. In year 2013, Lalit

    Kishor & Dinesh Goyal [5] proposed a median based time quantum scheduling algorithm which is combination of SJF &

    RR. In year 2012, H.S. Behera [6] proposed the summation of mean and standard derviation based time quantum

    scheduling algorithms which is combination of SJF & RR. In year 2013, Aashna Bisht [7] performed a work Enhanced

    Round Robin(ERR), in which modifying the time quantum of only those processes which require a slightly greater time

    than the allotted time quantum cycle. The remaining processes will be executed in the conventional Round robin manner.

    In year 2011, Rakash Mohanty & Manas Das [8] performed a work in which a new variant of Round Robin scheduling

    algorithms by executing the processes according to the new calculated Fit fact

    time quantum. In year 2012, Debashree Nayak & Sanjeev Kumar Malla[11] performed a work in which a median plus

    some other value are added in time quantum. This scheduling algorithm which is combination of SJF & RR. In year

    2012, Ishwari Singh Rajput, Deepa Gupta[13] proposed priority based Round-robin CPU scheduling algorithms is based

    on the integration of round robin and priority scheduling. It retains the advantage of round robin in reducing starvation

    and also integrates the advantage of priority scheduling. The proposed new algorithm also implements the concepts of

    aging by assigning new priorities to the processes. In year 2012, P.Surendra Varma[14] performed a work, In which the

    improved version of SRBRR (Shortest Remaining Burst Round Robin) by assigning the processor to processes with

    shortest remaining burst in round robin manner using the best possible time quantum. In this paper the time quantum is

    computed with the help of median and highest burst time. In year 2012, H.S. Behera & Brajendra Kumar Swain[15]

    performed a work it gives precedence to all processes according to their priority and burst time, then applies the RR

    algorithm on it. This Proposed algorithm is developed by taking dynamic mean time quantum in to account. In year 2012,

    Brajendra Kumar Swain, H.S Behera and Anmol Kumar Parida[17] in this paper the new algorithm used Round Robin

    with Highest Response Ratio next scheduling, which uses Highest Response Ratio criteria for selecting processes from

    ready queue. In year 2010, Rakesh kumar Yadav, Abhishck K Mishra, Navin Prakash and Himanshu Sharma [19]

    performed a work. In this paper the new algorithm are used Round Robin with shortest Job first scheduling. In which

    allocate all processes to the CPU only one time as like present RR Scheduling algorithm. After second round select

    shortest job from the waiting queue and it shortest job assign to the CPU. After that next shortest job are selected. In

    year 2012, Ali Jbaeer Dawood [20] performed a work. The processes were ascending with shortest remaining burst time

    and calculate the TQ from multiply the average summation of minimum and maximum BT by (80) percentage.

    III . PROPOSED ALGORITHMS CPU scheduling is the basis of multiprogrammed O.S. Most CPU scheduling algorithms concentrate on maximizing

    throughput, CPU utilization and minimizing waiting time, response time, turnaround time and number of context

    switching for a set of requests. Some of the CPU scheduling algorithms are First-Come-First-Served (FCFS), Priority

    Scheduling, Shortest Job First (SJF) and Round Robin (RR). FCFS is the simplest form of CPU scheduling algorithm.

  • Shyam et al., International Journal of Advanced Research in Computer Science and Software Engineering 4(7),

    July - 2014, pp. 1-6

    2014, IJARCSSE All Rights Reserved Page | 172

    These algorithms are easy to implement, but it generall y does not provide the best service. Round Robin being the most

    popular in time shared operating system, but it may not be suitable for real time operating systems because of high

    turnaround time, waiting time and large number of context switches. This result paper describes an improvement in

    RR. A simple pseudo code has been designed.

    Proposed Pseudo code:

    1. First all the processes present in ready queue are sorted in ascending order of their burst time.

    2. While(Ready queue!= NULL)

    // A = Set of processes, where (A1,A2.....An) A and n = Total no. of processes

    3. Assign TQ to (1 to n) process for j = 1 to n {

    4 Calculate the remaining burst time of the processes. 5. if ( new process is arrived and BT != 0 ) //BT = burst time

    go to step 1, else if ( new process is not arrived and BT !=0)

    go to step 2, else

    go to step 6, end if, end while

    6. Calculate ATT, AWT and CS.

    //ATT = Average Turnaround Time , AWT = Average Waiting Time , CS = No. of Context Switches

    7. End

    In this paper the proposed algorithm are used Round Robin with shortest Job first scheduling. The TQ studied to improve

    the efficiency of RR and performs degrades with respect to context switching, Average Wait Time and Average

    turnaround time. This approach was proposed to calculate the TQ, known as square root of mean and Highest Burst

    multiplied values. The processes were ascending with shortest remaining burst time and then TQ are given to that

    ascending process to CPU. Then the proposed algorithm performs better than Round Robin (RR), Improved Round

    Robin (IRR), FCFS and some other scheduling algorithm in terms of reducing the number of context switches, average

    turnaround time and average waiting time.

    Flow chart of the proposed algorithm:

    TQ =

    P

    New process is

    arrived and BT!=0

    New process is not

    arrived and BT!=0

    Read queue !=Null

    stop

    Calculate the AWT, ATT

    and CS

    Y

    Y

    Y

    N

    N

    Start

    Sort the process in

    ascending order

  • Shyam et al., International Journal of Advanced Research in Computer Science and Software Engineering 4(7),

    July - 2014, pp. 1-6

    2014, IJARCSSE All Rights Reserved Page | 173

    IV . ILLUSTRATION Suppose five processes arriving time=0, and CPU burst time is (P1=75, P2=70, P3=5, P4=20, P5=80). Then the

    processes are sorted in ascending order which results in sequence P3=5, P4=20, P2=70, P1=75, P5=80. Then TQ is

    calculated. Where TQ is the square root of mean and highest burst time i.e. MEAN= (5+20+70+75+80)/5=50. So TQ is

    P4=0,

    P2=7, P1=12, P5=17. In this case, processes P3 and P4 are deleted from the ready queue. If that time new process

    arrived suppose that are P6=25 and arrival time 214 then new time quantum is find out. New time quantum is

    After second iteration the remaining CPU burst time sequence is P2=0, P4=0, P1=0, P6=7. In this

    case, processes P2, P4, P1 are deleted from the ready queue. If third iteration no new process arrived then old time

    quantum is used. Since, now there is no process in ready queue. Then calculates the ATT and AWT. In this example

    AWT=86.6, ATT=168.

    V. EXPERIMENTAL ANALYSI S 1. Analysis of IMRRSJF algorithm with RR, IRR, ERR and SARR algorithm. In every case we will compare the result of the proposed IMRRSJF method with Round Robin, Improved RR[1],

    Enhanced RR[7] and Self adjustment RR (SARR)[2]. The static time quantum (TQ) for RR, IRR and ERR

    algorithm is 20 taken. In SARR algo. median time quantum is used.

    Case1: CPU burst time in random order-

    and burst time(11,52,35,22,80) as shown in table 1. Table 2 shows the output of 5 algo. and Figure 3 shows

    Gantt chart.

    TABLE 1

    PROCESS NO. ARRIVAL TIME BURST TIME

    P1 0 11

    P2 0 52

    P3 0 35

    P4 0 22

    P5 0 80

    TABLE 2

    ALGORITHM TIME QUANTUM AVG. WAITING TIME AVG. TURANAROUND

    IMRRSJF 56 46.4 86.4

    RR 20 85 125

    IRR 20 61 101

    ERR 20 74.4 114.4

    SARR 35 74 114

    TABLE 3

    IMRRSJF

    P1(11) P4(22) P3(35) P2(52) P5(56) P5(24)

    0 11 33 68 120 176

    200

    RR

    P1(11) P2(20) P3(20) P4(20) P5(20) P2(20) P3(15) P4(2) P5(20) P2(12) P5(20) P5(20)

    0 11 31 51 71 91 111 126 128 148 160 180

    200

    IRR

    P1(11) P2(20) P3(20) P3(15) P4(20) P4(2) P5(20) P2(20) P2(12) P5(20) P5(20) P5(20)

    0 11 31 51 66 86 88 108 128 140 160 180

    200

    ERR

    P1(11) P2(20) P3(20) P4(20) P4(2) P5(20) P2(20) P3(15) P5(20) P2(12) P5(20) P5(20)

    0 11 31 51 71 73 93 113 128 148 160 180

    200

    SARR

    P1(11) P2(35) P3(35) P4(22) P5(35) P2(17) P5(35) P5(10)

    0 11 46 81 103 138 155 190

    200

  • Shyam et al., International Journal of Advanced Research in Computer Science and Software Engineering 4(7),

    July - 2014, pp. 1-6

    2014, IJARCSSE All Rights Reserved Page | 174

    COMPARITIVE BARCHART OF WAITING TIME AND TURANAROUND TIME IN CASE 1

    Case2: CPU burst time in decreasing order-

    rocesses(P1,P2,P3,P4,P5) with arrival time=0 and burst time(80,52,35,22,11) as shown in

    table 4 and Table 5 shows the output of 5 algo. and Figure 6 shows Gantt chart.

    TABLE 4

    PROCESS NO. ARRIVAL TIME BURST TIME

    P1 0 80

    P2 0 52

    P3 0 35

    P4 0 22

    P5 0 11

    TABLE 5

    ALGORITHM TIME QUANTUM AVG. WAITING TIME AVG. TURANAROUND

    IMRRSJF 56 46.4 86.4

    RR 20 113 153

    IRR 20 88 128

    ERR 20 100.6 140.6

    SARR 35 112 152

    TABLE 6

    IMRRSJF

    P5(11) P4(22) P3(35) P2(52) P1(56) P1(24)

    0 11 33 68 120 176

    200

    RR

    P1(20) P2(20) P3(20) P4(20) P5(11) P1(20) P2(20) P3(15) P4(2) P1(20) P2(12) P1(20)

    0 20 40 60 80 91 111 131 146 148 168 180

    200

    IRR

    P1(20) P2(20) P3(20) P3(15) P4(20) P4(2) P5(11) P1(20) P2(20) P2(12) P1(20) P1(20)

    0 20 40 60 75 95 97 108 128 148 160 180

    200

    ERR

    P1(20) P2(20) P3(20) P4(20) P4(2) P5(11) P1(20) P2(20) P3(15) P1(20) P2(12) P1(20)

    0 20 40 60 80 82 93 113 133 148 168 180

    200

    SARR

    P1(35) P2(35) P3(35) P4(22) P5(11) P1(35) P2(17) P1(10)

    0 35 70 105 127 138 173 190

    200

    0

    20

    40

    60

    80

    100

    120

    140

    IMRRSJF RR IRR ERR SARR

    WAITING TIME

    TURNAROUND TIME

  • Shyam et al., International Journal of Advanced Research in Computer Science and Software Engineering 4(7),

    July - 2014, pp. 1-6

    2014, IJARCSSE All Rights Reserved Page | 175

    COMPARITIVE BARCHART OF WAITING TIME A ND TURANAROUND TIME IN CASE 2

    Case3: CPU burst time in increasing order-

    and burst time(11,22,35,52,80) as shown in table 7. Table 8 shows the output of 5 algo. and Figure 9 shows

    Gantt chart.

    TABLE 7

    PROCESS NO. ARRIVAL TIME BURST TIME

    P1 0 11

    P2 0 22

    P3 0 35

    P4 0 52

    P5 0 80

    TABLE 8

    ALGORITHM TIME QUANTUM AVG. WAITING TIME AVG. TURANAROUND

    IMRRSJF 56 46.4 86.4

    RR 20 74.4 114.4

    IRR 20 50.4 90.4

    ERR 20 62.4 102.4

    SARR 35 53.4 93.4

    TABLE 9

    IMRRSJF

    P1(11) P2(22) P3(35) P4(52) P5(56) P5(24)

    0 11 33 68 120 176

    200

    RR

    P1(11) P2(20) P3(20) P4(20) P5(20) P2(2) P3(15) P4(20) P5(20) P4(12) P5(20) P5(20)

    0 11 31 51 71 91 93 108 128 148 160 180

    200

    IRR

    P1(11) P2(20) P2(2) P3(20) P3(15) P4(20) P5(20) P4(20) P4(12) P5(20) P5(20) P5(20)

    0 11 31 33 53 68 88 108 128 140 160 180

    200

    ERR

    P1(11) P2(20) P2(2) P3(20) P4(20) P5(20) P3(15) P4(20) P5(20) P4(12) P5(20) P5(20)

    0 11 31 33 53 73 93 108 128 148 160 180

    200

    SARR

    P1(11) P2(22) P3(35) P4(35) P5(35) P4(17) P5(35) P5(10)

    0 11 33 68 103 138 155 190

    200

    0

    20

    40

    60

    80

    100

    120

    140

    160

    180

    IMRRSJF RR IRR ERR SARR

    WAITING TIME

    TURNAROUND TIME

  • Shyam et al., International Journal of Advanced Research in Computer Science and Software Engineering 4(7),

    July - 2014, pp. 1-6

    2014, IJARCSSE All Rights Reserved Page | 176

    COMPARITIVE BARCHART OF WAITING TIME AND TURANAROUND TIME IN CASE 3

    Turbo C++ is used to implement the sourse code and result. Here are some screen shorts of results.

    020406080

    100120140

    WAITING TIME

    TURANAROUND TIME

  • Shyam et al., International Journal of Advanced Research in Computer Science and Software Engineering 4(7),

    July - 2014, pp. 1-6

    2014, IJARCSSE All Rights Reserved Page | 177

    2. Analysis of IMRRSJF algorithm with MMDRR [6] and TQBISA [5]. In which we compare the result of the proposed IMRRSJF method with Time quantum based improved Scheduling

    algorithms TQBISA [5] and Modified mean-deviation Round Robin MMDRR [6].

    Here are some screen shorts that shows comparative results.