Non Preemptive Priority based Scheduling 1 - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Non Preemptive Priority based Scheduling 1

Description:

Non Pre-emptive Priority based Scheduling - 1 ... minimum Time allotted to each process is one Time Quantum as allocated to that priority. ... – PowerPoint PPT presentation

Number of Views:596
Avg rating:3.0/5.0
Slides: 19
Provided by: hardwa
Category:

less

Transcript and Presenter's Notes

Title: Non Preemptive Priority based Scheduling 1


1
Non Pre-emptive Priority based Scheduling - 1
  • Consider the following Process mix to be
    scheduled.
  • --------------------------------------------------
    ----------------------------------
  • 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
  • --------------------------------------------------
    -----------------------

2
Non Pre-emptive Priority based Scheduling - 2
  • Important Assumptions
  • 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.

3
Non Pre-emptive Priority based Scheduling - 3
  • Important Assumptions (contd.)
  • 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 List.
  • c) Next the Dispatcher is invoked in order
    to select the process
  • having the highest priority in the
    Ready List to be scheduled
  • next.

4
Non Pre-emptive Priority based Scheduling - 4
  • 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
  • --------------------------------------------------
    -----------------------

5
Non Pre-emptive Priority based Scheduling - 5
  • Dispatcher Enqueuer Block Structures

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

6
Non Pre-emptive Priority based Scheduling - 6
  • The GANTT Chart

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
7
Non Pre-emptive Priority based Scheduling - 7
  • The GANTT Chart Contd.

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
8
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
  • --------------------------------------------------
    ----------------------------------
  • 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
  • --------------------------------------------------
    -----------------------

9
Pre-emptive Priority based Scheduling 1
Multiple Ready Queues
  • 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
  • --------------------------------------------------
    -----------------------

10
Pre-emptive Priority based Scheduling 2
Multiple Ready Queues
  • One Ready Queue for each Priority Level.
  • Individual Processes within a particular Queue
    are arranged serviced in FCFS fashion.
  • Time Quantum associated with each Queue
  • happens to be the following
  • Priority Level Allotted Time
    Quantum
  • 1
    10 units
  • 2
    20 units
  • 3
    30 units
  • 4
    40 units

11
Pre-emptive Priority based Scheduling 3
Multiple Ready Queues
  • Servicing Policy CPU goes round robin in the
    following manner
  • Within the same queue, round robin based on the
    First Come First Serve (FCFS) basis.
  • CPU moves among the different queues with
    prefixed number of Time Slice allocation as
    depicted below
  • Priority Level CPU Time(Approx)
    Implication
  • 1. 40
    4 Time slice of 10
  • 2. 30
    2 Time slice of 20
  • 3. 20
    1 Time slice of 30
  • 4. 10
    1 Time slice of 40
  • If however any queue happens to be empty , CPU
    cycles through to next/previous priority Level OR
    restricts itself to same priority level .

12
Pre-emptive Priority based Scheduling 4
Multiple Ready Queues , Assumptions
  • 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 at the Front of its respective priority
    Ready Queue.
  • b) The Enqueuer is brought into execution
    (running state) after
  • a context switch which brings the
    newly arrived process at
  • the back of its respective priority
    Ready Queue.
  • c) Next the Dispatcher is invoked in order
    to select the process
  • based on the scheduling policy
    illustrated before I.e. remaining part of the
    Time Quantum allocated to that process gets LOST.
  • d) However , once ALL process has arrived
    then perfect Round Robin Policy is followed and
    minimum Time allotted to each process is one Time
    Quantum as allocated to that priority.

13
Pre-emptive Priority based Scheduling 5
Multiple Ready Queues
  • Various Queue Structures

P2 250 Units Service P0 200 Units Service
Arrived at 130 Arrived at 80
Priority Level 1 Queue Time slice 10 Units X
4
P4 300 Units Service Arrived at 200
Priority Level 2 Queue Time slice 20 Units X
2
P1 400 Units Service Arrived at 10
Priority Level 3 Queue Time slice 30 Units X
1
P3 500 Units Service Arrived at 60
Priority Level 4 Queue Time slice 40
Units X 1
14
Pre-emptive Priority based Scheduling 6
Multiple Ready Queues
  • Dispatcher Enqueuer Block Structures

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

15
Pre-emptive Priority based Scheduling 7
Multiple Ready Queues
  • The GANTT Chart

EnQ P1 (Pr3)
P1(Pr 3) 30 Done 370 Left
EnQ P3 (Pr4)
DiS P1
P1(Pr 3) 7 Done 363 Left
DiS P3
DiS P1
10 13 18
48 53 60
63 68
EnQ P0 (Pr1)
DiS P0
P0(Pr 1) 10 Done 190 Left
DiS P0
P3(Pr 4) 12 Done 488 Left
P0(Pr 1) 10 Done 180 Left
68 80 83
88 98 103
113
16
Pre-emptive Priority based Scheduling 8
Multiple Ready Queues
  • The GANTT Chart Contd.

P0(Pr 1) 30 Done 170 Left
DiS P0
DiS P1
DiS P0
EnQ P2 (Pr1)
P0(Pr 1) 40 Done 160 Left
113 118 128 133
136 146 151
P1(Pr 3) 66 Done 334 Left
P3(Pr 4) 26 Done 474 Left
DiS P3
EnQ P4 (Pr2)
DiS P0
151 181 186
200 203 208
17
Pre-emptive Priority based Scheduling 9
Multiple Ready Queues
  • The GANTT Chart Contd.

P0(Pr 1) 50 Done 150 Left
DiS P2
DiS P0
P2(Pr 1) 10 Done 240 Left
208 218 223
233 238
P2(Pr 1) 20 Done 230 Left
DiS P2
DiS P4
P2(Pr 1) 60 Done 140 Left
238 248 253
263 268
18
Pre-emptive Priority based Scheduling 10
Multiple Ready Queues
  • The GANTT Chart Contd.

DiS P4
DiS P1
P4(Pr 2) 20 Done 280 Left
P4(Pr 2) 40 Done 260 Left
P1(Pr 3) 30 Done 334 Left
268 288 293
313 318
348
DiS P0
DiS P3
P3(Pr 4) 40 Done 437 Left
P0(Pr 1) 70 Done 130 Left
DiS P2
348 353 393
398 408 413
Write a Comment
User Comments (0)
About PowerShow.com