Short Term Scheduling Policies The Issues - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

Short Term Scheduling Policies The Issues

Description:

Form the READY Queue of Processes based on their pre fixed Deadline. ... Each process is assigned a pre-fixed priority ( a non ve integer between 1. ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 30
Provided by: hardwa
Category:

less

Transcript and Presenter's Notes

Title: Short Term Scheduling Policies The Issues


1
Short Term Scheduling PoliciesThe Issues
  • For any of the Short Term scheduling policies,
    one needs to compute the following
  • i) Specify the Gantt Chart ( A chart depicting
    the allocation sequence of each of the processes
    User Process block as well as Kernel Processes
    to the CPU as well as the corresponding CPU
    occupancy time.)
  • ii) The average Turn around time for ALL the
    concerned USER Processs CPU bound Chunks.
  • iii) The average Waiting time for ALL the
    concerned USER Processs CPU bound Chunks.
  • .

2
Short Term Scheduling Policies Common
Assumptions - 1
  • Assume Context switching time 1 unit (fixed).
  • Dispatcher Execution time 3 units
    (fixed).
  • Enqueuer Execution time 2 units
    (fixed).
  • For any of the specified Ready Queue Status one
    needs to compare the performances of the adopted
    scheduling policies following non preemptive
    scheduling policies
  • (a)First come First Served (FCFS).
  • (b) Shortest Job First (SJF) based on the
    Estimated Service Time.
  • (c) Dead Line based (starting with job having
    shortest service time in case of Same Deadline
    Limits).
  • (d) Pre-Fixed Priority Based with Fixed Number
    of Priority levels , where each of the Processes
    assigned a Pre-Fixed Priority from the set of
    available number of Priorities.

3
Short Term Scheduling Policies Common
Assumptions - 2
  • Each of the Process has to be scheduled by the
    Dispatcher.
  • Context Switching Dispatcher Time Context
    Switching has to be there between any two
    processes .
  • Arrival of any new Process will cause the running
    user process to be pre-empted and invoking of the
    Enqueuer while invoking of Enqueuer will also
    cause the context switch before after the
    Enqueuer.

Context Switch Dispatcher 1 Unit 3 Units
Context Switch 1 Unit
Context Switch Enqueuer 1 Unit
2 Units
Context Switch 1 Unit

4. There cannot be two Successive Context
Switches.
4
Non Pre Emptive Short Term Scheduling Policies
  • (a)First come First Served (FCFS).
  • (b) Shortest Job First (SJF) based on the
    Estimated Service Time.
  • (c) Dead Line based (starting with job having
    shortest service time in case of Same Deadline
    Limits).
  • (d) Pre-Fixed Priority Based with Fixed Number of
    Priority levels , where each of the Processes
    assigned a Pre-Fixed Priority from the set of
    available number of Priorities.

5
Case Study - 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 (Estimated)
    in units
  • --------------------------------------------------
    ----------------------------------
  • P0 10 200
    560
  • P1 5
    400 1100
  • P2 13 250
    none
  • P3 8
    50 250
  • P4 20 300
    650
  • --------------------------------------------------
    -----------------------

6
Short Term Scheduling Policies Non Pre-emptive
FCFS - 1
  • The Policy
  • Form the READY Queue of Processes based on their
    Arrival Time.
  • Select Process from the READY Queue Front for
    Dispatching.
  • Repeat the previous step till READY Queue is
    Empty.

7
Short Term Scheduling Policies Non Pre-emptive
FCFS - 2
  • 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
  • --------------------------------------------------
    ------------------------

8
Short Term Scheduling Policies Non Pre-emptive
FCFS - 3
  • GANTT Chart

P1
P3
P0
P2
P4
DiS P3
DiS P0
DiS P2
DiS P4
DiS P1
EnQ P1
EnQ P3
EnQ P0
EnQ P2
EnQ P4
DiS P1
5 8 11 14 17 22 25 30
430 435 485 490
690 695 945 950 1250

9
Short Term Scheduling Policies Non Pre-emptive
FCFS - 4
  • The Various Time Structure
  • --------------------------------------------------
    ------------------------
  • Process Arrival Time Service time
    Turnaround Waiting

  • Time Time
  • --------------------------------------------------
    ------------------------
  • P1 5
    400 430- 5 425 25-5
    20
  • P3 8
    50 485-8 477 435-8 427
  • P0 10 200
    690-10 680 490-10 480
  • P2 13 250
    945-13932 695-13 687
  • P4 20 300
    1250-201230 950-20 930
  • --------------------------------------------------
    ---------------------------------------

10
Short Term Scheduling Policies Non Pre-emptive
FCFS - 5
  • Total Turn Around Time 4254776809321230
    3744 units
  • Average Turn Around Time 3744 / 5 748.8
    units
  • Total Waiting Time 20427480682930 2539
    units
  • Average Waiting Time 2539 / 5 507.8 units

11
Short Term Scheduling Policies Non Pre-emptive
SJF - 1
  • The Policy
  • Form the READY Queue of Processes based on their
    Estimated Service Time.
  • Select Process from the READY Queue Front for
    Dispatching.
  • Repeat the previous step till READY Queue is
    Empty.

12
Short Term Scheduling Policies Non Pre_emptive
SJF - 2
  • 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
  • --------------------------------------------------
    ------------------------

13
Short Term Scheduling Policies Non Pre-emptive
SJF - 3
  • GANTT Chart

P3
P0
P2
P4
P1
DiS P0
DiS P2
DiS P4
DiS P1
DiS P3
EnQ P1
EnQ P3
EnQ P0
EnQ P2
EnQ P4
DiS P3
5 8 11 14 17 22 25 30
80 85 285 290
540 545 845 850 1250

14
Short Term Scheduling Policies Non Pre-emptive
SJF - 4
  • The various Time Status
  • --------------------------------------------------
    ------------------------
  • Process Arrival Time Service time
    Turnaround Waiting

  • Time Time
  • --------------------------------------------------
    ------------------------
  • P3 8
    50 80-8 72 30-8 22
  • P0 10 200
    285-10 275 85-10 75
  • P2 13 250
    540-13527 290-13 277
  • P4 20 300
    845-20825 545-20 525
  • P1 5
    400 1250- 5 1245 850-5 845
  • --------------------------------------------------
    ---------------------------------------

15
Short Term Scheduling Policies Non Pre-emptive
SJF - 5
  • Total Turn Around Time 722755278251245
    2944 units
  • Average Turn Around Time 2944/ 5 588.8
    units
  • Total Waiting Time 2275277525845 1744
    units
  • Average Waiting Time 1744 / 5 348.8 units

16
Short Term Scheduling Policies Non Pre-emptive
Deadline Based - 1
  • The Policy
  • Form the READY Queue of Processes based on their
    pre fixed Deadline.
  • Select Process from the READY Queue Front for
    Dispatching.
  • Repeat the previous step till READY Queue is
    Empty.

17
Short Term Scheduling Policies Non Pre-emptive
Deadline Based - 2
  • 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
  • --------------------------------------------------
    ------------------------

18
Short Term Scheduling Policies Non Pre-emptive
Deadline Based - 3
  • GANTT Chart

P3
P0
P4
P1
P2
DiS P0
DiS P4
DiS P1
DiS P2
DiS P3
EnQ P1
EnQ P3
EnQ P0
EnQ P2
EnQ P4
DiS P3
5 8 11 14 17 22 25 30
80 85 285 290
590 595 995 1000 1250

19
Short Term Scheduling Policies Non Pre-emptive
Deadline Based - 4
  • The various Time Status
  • --------------------------------------------------
    ------------------------
  • Process Arrival Time Service time
    Turnaround Waiting

  • Time Time
  • --------------------------------------------------
    ------------------------
  • P3 8
    50 80-8 72 30-8 22
  • P0 10 200
    285-10 275 85-10 75
  • P4 20 300
    590-20 570 290-20 270
  • P1 5
    400 995- 5 990 595-5 590
  • P2 13 250
    1250-131237 1000-13987
  • --------------------------------------------------
    ---------------------------------------

20
Short Term Scheduling Policies Non Pre-emptive
Deadline Based - 5
  • Total Turn Around Time 722755709901237

  • 3144 units
  • Average Turn Around Time 3144 / 5 628.8
    units
  • Total Waiting Time 2275270590 9871944
    units
  • Average Waiting Time 1944 / 5 388.8 units

21
Non Pre-emptive Priority based Scheduling Basic
Features - 1
  • Each process is assigned a pre-fixed priority (
    a non ve integer between 1 .. 10) either by the
    System Manager depending on the jobs importance
    OR by the internal policy of the concerned
    operating system.
  • Lower priority value ? Higher Priority.
  • Higher priority processes are dispatched /
    scheduled first.
  • Processes having the same priority are chosen on
    a First Come First Served (FCFS) basis.

22
Non Pre-emptive Priority based Scheduling Basic
Features - 2
  • As soon as any new process is brought in the
    memory by the Medium Term Scheduler, the
    following events take place in sequence
  • a) The currently running process is brought
    back into Ready
  • State from the Running State.
  • b) The Enqueuer is brought into execution
    (running state) after
  • a context switch which brings the
    newly arrived process in
  • the Ready Queue.
  • c) Next the Dispatcher is invoked in order
    to select the process
  • having the current highest priority in
    the Ready Queue to be
  • dispatched next.
  • Thus the previously Running Process may
    re-run if that is still having the Highest
    Priority OR alternately a new process may get
    dispatched.

23
Non Pre-emptive Priority Based Scheduling Case
Study- 1
  • Consider the following Process mix
  • --------------------------------------------------
    ----------------------------------
  • Process Arrival Time Service time
    Pre-Assigned
  • Chunk No. in units in units
    Priority
  • --------------------------------------------------
    ----------------------------------
  • P0 80 200
    1
  • P1 10 400
    3
  • P2 130 250
    1
  • P3 60 500
    4
  • P4 200 300
    2
  • --------------------------------------------------
    -----------------------

24
Non Pre-emptive Priority based Scheduling Case
Study - 2
  • Consider the Process mix to be scheduled in order
    of arrival.
  • --------------------------------------------------
    ----------------------------------
  • Process Arrival Time Service time
    Pre-Assigned
  • Chunk No. in units in units
    Priority
  • --------------------------------------------------
    ----------------------------------
  • P1 10 400
    3
  • P3 60 500
    4
  • P0 80 200
    1
  • P2 130 250
    1
  • P4 200 300
    2
  • --------------------------------------------------
    -----------------------

25
Non Pre-emptive Priority based Scheduling Case
Study - 3
  • Dispatcher Enqueuer Block Structures BUT with
    no two consecutive Context Switches.

Context Switch Dispatcher Context Switch 1 Unit
3 Units 1 Unit
Context Switch Enqueuer Context Switch 1 Unit
2 Units 1 Unit

26
Non Pre-emptive Priority based Scheduling GANTT
Chart -1

EnQ P1 (Pr3)
P1(Pr 3) 42 Done 358 Left
EnQ P3 (Pr4)
DiS P1
P1(Pr 3) 54 Done 346 Left
EnQ P0 (Pr1)
DiS P0
DiS P1
10 13 18
60 63 68
80 83 88
P0(Pr 1) 42 Done 158 Left
EnQ P2 (Pr1)
DiS P0
P0(Pr 1) 104 Done 96 Left
EnQ P4 (Pr2)
DiS P0
88 130 133 138
200 203 208
27
Non Pre-emptive Priority based Scheduling GANTT
Chart - 2

P0(Pr 1) 200 Done COMPLETED
DiS P2
P2(Pr 1) 250 Done COMPLETED
DiS P4
P4(Pr 2) 300 Done COMPLETED
208 304 309
559 564
864
P1(Pr 3) 400 Done 346 was Left
DiS P1
P3(Pr 4) 500 Done COMPLETED
DiS P3
864 869 1215 1220
1720
28
Non Pre-emptive Priority based Scheduling - 8
  • The various timing Calculations
  • --------------------------------------------------
    ----------------------------------
  • Process Arrival Time Turn Around time
    Waiting Time
  • Chunk No. in units in units
    in units
  • Priority
  • --------------------------------------------------
    ----------------------------------
  • P0 1 80 304 80
    224 88-80 8
  • P1 3 10 1215 10
    1205 18 10 8
  • P2 1 130 559 130
    429 309 -130 179
  • P3 4 60 1720 60
    1660 1220 60 1160
  • P4 2 200 864 200
    664 564 200 364
  • --------------------------------------------------
    -----------------------

29
Short Term Scheduling Policies Non Pre-emptive
Priority Based - 9
  • Total Turn Around Time 22412054291660664

  • 4182 units
  • Average Turn Around Time 4182 / 5 836.4
    units
  • Total Waiting Time 881791160 364 1719
    units
  • Average Waiting Time 1719 / 5 343. 8units
Write a Comment
User Comments (0)
About PowerShow.com