60 likes | 235 Views
K SAMPATH KUMAR. 11CS10022. PRIORITY SCHEDULING OF PROCESSES . It is implemented using multiple ready queues to represent each level of priority The OS keeps track of process state by maintaining a queue of PCBs for each state
E N D
K SAMPATH KUMAR 11CS10022
PRIORITY SCHEDULING OF PROCESSES • It is implemented using multiple ready queues to represent each level of priority • The OS keeps track of process state by maintaining a queue of PCBs for each state • The ready queue contains PCBs of processes that are waiting to be assigned to the CPU • Associate each process with priority and select the process of a higher priority over one of lower priority(pre emptive or non pre emptive.) • Lower the value ,higher is the priority of the process • Priority may be internally defined by OS or externally by the user • statically assigned priority or dynamically set based on execution properties • Lower-priority may suffer starvation as it won’t execute • To alleviate starvation allow dynamic priorities .The priority of a process changes based on its age or execution history (i.e increases with time.) 1
ROUND ROBIN SCHEDULING ALGORITHM • Policy is targeted to time-sharing systems similar to FCFS but permit preemption • Each process assigned a time quantum q, typically 10-100ms (40ms). • At quantum expiration process moved to tail of Ready Q • Preemption after fixed time interval and place on tail of ready-queue. always select next process from head of ready-queue • If n processes in ready queue, time quantum = q, then each process receives 1/n of CPU time in chunks of at most q units. So,Noprocess waits more than (n-1)q time units for CPU. • Performance depends on size of time quantum
If q is large then behaves like FCFS • If q is small then appears as dedicated processor with speed 1/n actual – called processor sharing • q should be large compared to context switch time otherwise considerable time is wasted on context switching,and not too large to avoid penalizing I/O bound processes. • Too long => poor response time • Infinite => performance is the same as FIFO • Too short => poor throughput • Turnaround time also depends on quantum • Better performance if most processes complete within one time quantum
RR pros & cons: • Works well for short jobs; typically used in timesharing systems. • High overhead due to frequent context switches. • Increases average waiting time, especially if CPU bursts are the same length and need more than one time quantum.