Title: Short Term Scheduling Policies Example 1
1Short Term Scheduling Policies Example - 1
- Consider a typical Ready queue status of a
computer system having Uni-processor with support
for multi programming as given below. - --------------------------------------------------
---------------------------------- - Process Arrival Time Service time
Deadline Limits - Chunk No. in units in units
in units - --------------------------------------------------
---------------------------------- - P0 10 200
560 - P1 5
400 1100 - P2 13 250
none - P3 8
50 250 - P4 20 300
650 - --------------------------------------------------
-----------------------
2Short Term Scheduling Policies Example - 2
- Assume Context switching time 1 unit (fixed).
- Dispatcher Execution time 3 units
(fixed). - Enqueuer Execution time 2 units
(fixed). - For the Ready Queue Status as specified on the
prev. slide, compare the performances of the
following non preemptive scheduling policies - (a)First come First Served (FCFS).
- (b) Shortest Job First (SJF).
- (c) Dead Line based (starting with job having
shortest service time).
3Short Term Scheduling Policies Example - 2
- For each of the aforesaid scheduling policies,
you are to depict the following - i) Specify the Gantt Chart ( A chart depicting
the allocation sequence of each process block to
the CPU as well as the occupancy time.) . - ii) Compute the average Turn around time.
- iii) Compute the average Waiting time.
4Short Term Scheduling Policies Example - 3
- Assumption (For all scheduling policies)
- Context Switching Dispatcher Time
- has to be there between any two processes while
invoking of Enqueuer will also cause the context
switch before after but there cannot be two
successive context switches. -
Context Switch Dispatcher 1 Unit 3 Units
Context Switch Enqueuer 1 Unit
2 Units
5Short Term Scheduling Policies Non Pre-emptive
FCFS - 1
- The READY Queue / List structure
- --------------------------------------------------
------------------------ - Process Arrival Time Service time
- --------------------------------------------------
------------------------ - P1 5
400 - P3 8
50 - P0 10 200
- P2 13 250
- P4 20 300
- --------------------------------------------------
------------------------
6Short Term Scheduling Policies Non Pre-emptive
FCFS - 2
P1
P3
P0
P2
P4
DiS
DiS
DiS
DiS
DiS P1
EnQ P1
EnQ P3
EnQ P0
EnQ P2
EnQ P4
5 8 11 14 17 22 25
425 430 480 485
685 690 940 945 1245
7Short Term Scheduling Policies Non Pre-emptive
FCFS - 3
- The Various Time Structure
- --------------------------------------------------
------------------------ - Process Arrival Time Service time
Turnaround Waiting -
Time Time - --------------------------------------------------
------------------------ - P1 5
400 425- 5 420 25-5
20 - P3 8
50 480-8 472 430-8 422
- P0 10 200
685-10 675 485-10 475 - P2 13 250
940-13927 690-13 677 - P4 20 300
1245-201225 945-20 925 - --------------------------------------------------
---------------------------------------
8Short Term Scheduling Policies Non Pre-emptive
FCFS - 4
- Total Turn Around Time 4204726759271225
3719 units - Average Turn Around Time 3719 / 5 743.8
units - Total Waiting Time 20422475677925 2519
units - Average Waiting Time 2519 / 5 503.8 units
9Short Term Scheduling Policies Non Pre_emptive
SJF - 1
- Ready List / Queue Structure
- --------------------------------------------------
------------------------ - Process Arrival Time Service time
Deadline Limits - No. in units in units
in units - --------------------------------------------------
------------------------ - P3 8
50 250 - P0 10 200
560 - P2 13 250
none - P4 20 300
650 - P1 5
400 1100 - --------------------------------------------------
------------------------
10Short Term Scheduling Policies Non Pre-emptive
SJF - 2
P3
P0
P2
P4
P1
DiS
DiS
DiS
DiS
DiS P3
EnQ P1
EnQ P3
EnQ P0
EnQ P2
EnQ P4
5 8 11 14 17 22 25
75 80 280 285
535 540 840 845
1245
11Short Term Scheduling Policies Non Pre-emptive
SJF - 3
- The various Time Status
- --------------------------------------------------
------------------------ - Process Arrival Time Service time
Turnaround Waiting -
Time Time - --------------------------------------------------
------------------------ - P3 8
50 75-8 67 25-8 17 - P0 10 200
280-10 270 80-10 70 - P2 13 250
535-13522 285-13 272 - P4 20 300
840-20820 540-20 520 - P1 5
400 1245- 5 1240 845-5 840
-
- --------------------------------------------------
---------------------------------------
12Short Term Scheduling Policies Non Pre-emptive
SJF - 4
- Total Turn Around Time 672705228201240
2919 units - Average Turn Around Time 2919/ 5 583.8
units - Total Waiting Time 1770272520840 1719
units - Average Waiting Time 1719 / 5 343.8 units
13Short Term Scheduling Policies Non Pre-emptive
Deadline Based - 1
- Ready List/ Queue Structure
- --------------------------------------------------
------------------------ - Process Arrival Time Service time
Deadline Limits - No. in units in units
in units - --------------------------------------------------
------------------------ - P3 8
50 250 - P0 10 200
560 - P4 20 300
650 - P1 5
400 1100 - P2 13 250
none - --------------------------------------------------
------------------------
14Short Term Scheduling Policies Non Pre-emptive
Deadline Based - 2
P3
P0
P4
P1
P2
DiS
DiS
DiS
DiS
DiS P3
EnQ P1
EnQ P3
EnQ P0
EnQ P2
EnQ P4
5 8 11 14 17 22 25
75 80 280 285
585 590 990 945
1195
15Short Term Scheduling Policies Non Pre-emptive
Deadline Based - 3
- The various Time Status
- --------------------------------------------------
------------------------ - Process Arrival Time Service time
Turnaround Waiting -
Time Time - --------------------------------------------------
------------------------ - P3 8
50 75-8 67 25-8 17 - P0 10 200
280-10 270 80-10 70 - P4 20 300
585-20565 285-20 265 - P1 5
400 990- 5 985 590-5 585
- P2 13 250
1195-131182 945-13932 - --------------------------------------------------
---------------------------------------
16Short Term Scheduling Policies Non Pre-emptive
Deadline Based - 4
- Total Turn Around Time 672705659851182
3069 units - Average Turn Around Time 3069 / 5 613.8
units - Total Waiting Time 1770265585 932 1869
units - Average Waiting Time 1869 / 5 373.8 units