It is a CPU Scheduling Technique in which CPU is allocated to the process with highest priority. Equal priority processes are served in FCFS order.Priority is indicated by fixed range of numbers, it can be 0 to 10 or 0 to 1000. However there is no protocol that whether 0 will be highest priority or lowest. Some systems used lower numbers as lower priority and some systems uses lower numbers as highest priority.
Consider the following set of processes assumed to arrive at 0 in the order P1, P2 and P3 with the CPU Burst time in milliseconds.
Process Burst time Priority
P1 10 3
P2 5 1
P3 6 2
Gantt Chart using priority scheduling will be.
The average wait time is : 0+5+11/3= 5.3333 miliseconds
The priority cab be assigned internally or externally, priority scheduling can be preemptive or non-preemptive. Whenever a process comes to ready queue its priority is compared with current running process and if its priority is high CPU will be preempted. A non-preemptive priority algorithm just puts the new process at the head of ready queue.
Major problem with this scheduling Technique is indefinite blocking or starvation. Because a low priority process has to wait for a indefinite time until its turn come. To avoid the problem of starvation a Technique is used which is called aging. In this Technique priority of a process is increased which is waiting in the ready queue for long time.
Consider the following set of processes assumed to arrive at 0 in the order P1, P2 and P3 with the CPU Burst time in milliseconds.
Process Burst time Priority
P1 10 3
P2 5 1
P3 6 2
Gantt Chart using priority scheduling will be.
The average wait time is : 0+5+11/3= 5.3333 miliseconds
The priority cab be assigned internally or externally, priority scheduling can be preemptive or non-preemptive. Whenever a process comes to ready queue its priority is compared with current running process and if its priority is high CPU will be preempted. A non-preemptive priority algorithm just puts the new process at the head of ready queue.
Major problem with this scheduling Technique is indefinite blocking or starvation. Because a low priority process has to wait for a indefinite time until its turn come. To avoid the problem of starvation a Technique is used which is called aging. In this Technique priority of a process is increased which is waiting in the ready queue for long time.
No comments:
Post a Comment