Prerequisite – CPU Scheduling List Scheduling also known as Priority List Based Scheduling is a scheduling technique in which an ordered list of processes are made by assigning them some priorities. So, basically what happens is, a list of processes that are ready to be executed at a given point is made. And then depending on the availability of processors i.e, whether they are free or busy, if processors are free they pick the processes and execute them. Let us now understand the List Scheduling using one example. Example: Suppose we have 7 processes P1, P2, P3, P4, P5, P6, P7 such that –
- P3 is dependent on P1 and P2 (P3 can start its execution only when both P1 and P2 completes its execution.).
- P4 is dependent on P3 and P6 (P4 can start its execution only when both P3 and P6 completes its execution.).
- P6 is dependent on P5.
Dependencies are shown below in the figure.
- We have only two free processors, so let P1 and P2 gets executed first.
- P1 and P2 goes out of ready list and P3 comes in ready list. So P3, P5, P7 are in ready list now
- Lets assume out of 3 processes present in ready queue, P3 and P5 gets executed next, so P3 and P5 goes out of ready list and P6 comes in ready list. P4 will not come in ready list because it depends on P6 also which is not executed yet.
- P6 and P7 are in ready list now. So P6 and P7 gets executed next.
- P6 and P7 goes out of ready list and P4 comes in ready list and finally P4 gets executed and all the processes terminates .
Ready list is shown below at each step is shown in figure:
- Consider the case when same process starts with execution of P5 and P7 first this time instead of P1 and P2 .
- After that P5 and P7 comes out of ready list and P6 comes into ready list.
- P1, P2, P6 are in ready list now. Let P2 and P6 gets executed.
- P2 and P6 comes out of ready list. P1 gets executed then.
- P1 comes out of ready list and P3 comes in the ready list and then P3 gets executed.
- Finally P4 gets executed and all processes get executed.
Ready list for this process is shown below:
- Longest path algorithm
- Longest processing time
- Critical path method
Goal of algorithm is to maximize CPU utilization and minimize the delay.So whichever Scheduling algorithm helps to achieve this can used depending on the processes.