120 likes | 321 Views
Scheduling Algorithm. Lecture on 29/01/2014 Prepared by : Karimgailiu R Panmei 11CS10020. Four types of Scheduling algorithm 1. First Come First Serve 2. Shortest Job First Scheduling 3. Priority Scheduling 4. Round Robin (RR). First Come First Serve(FCFS)
E N D
Scheduling Algorithm Lecture on 29/01/2014 Prepared by : Karimgailiu R Panmei 11CS10020
Four types of Scheduling algorithm 1. First Come First Serve 2. Shortest Job First Scheduling 3. Priority Scheduling 4. Round Robin (RR)
First Come First Serve(FCFS) Process that has been in ready queue for the longest time is selected for running Turnaround time (TAT): Total time that the item spends in the system TAT=waiting time + service time Normalized TAT = TAT : service time
FCFS contd Performs better for long processes than short processes Favors processor-bound processes over I/O-bound processes Inefficiency use of the processor and I/O devices
Shortest Job First(SJF) Scheduling Process with shortest expected processing time is selected next Non-preemptive Performance in terms of response time is better than FCFS Variability of response time is increased and hence reducing the predictability
SJF contd Running average of each “burst” for each process : Sn+1=αTn+(1- α)Sn Where : Tn: processor execution time for nth process Sn+1 : Predicted value of (n+1) th instance α : constant weighted factor that determines the relative weight given to more recent or less recent observations 0<α<1
Shortest Remaining Time(SRT) First Preemptive version of Shortest-Job-First The scheduler always chooses the process that has the shortest expected remaining processing time No additional interrupts are generated thus reducing overhead Bias in favor of longer processes found in FCFS is removed in SRT Risk of starvation of longer processes
Round Robin Scheduling Also known as time slicing Each process is given an equal amount of time before being preempted Clock interrupt is generated at periodic intervals When interrupt occurs, the current process is placed back in ready queue and the next job is selected using FCFS
Round Robin Scheduling contd Effective in general purpose time-sharing system or transaction processing system Processor-bound processes receives more CPU time than I/O bound processes resulting in its poor performances Inefficient use of I/O devices Increase in the variance of response time
Priority Scheduling A priority is associated with each process CPU is allocated to the process having highest priority Equal-priority processes are scheduled in FCFS order The larger the CPU burst, the lower the priority Priority scheduling can be either pre -emptive or nonpreemptive
Priority Scheduling contd Preemptivepriority scheduling algorithm : Preempt the CPU if the priority of the newly arrived process is higher than the priority of the currently running process. Non-preemptive priority scheduling algorithm : Simply put the new process at the head of the ready queue.
Priority Scheduling contd Disadvantage : Indefinite blocking or starvation of process Processes with low priority can be left to wait indefinitely Solution : Aging Aging is a technique of gradually increasing the priority of processes that wait in the system for a long time.