SlideShare a Scribd company logo
Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling 主講人:虞台文
Content ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling Organization of Schedulers
Process Scheduling/Dispatching ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],We use “ scheduling ” to refer to  both .
Organization of Schedulers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],p i : process S   : scheduler
Organization of Schedulers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],S S S S OS S Unix Windows 2000 OS p 1 OS p 2 OS p 3 OS p 4 OS p 1 OS p 2 OS p 3 OS p 4
Priority Scheduling ,[object Object],[object Object],[object Object],[object Object],Who  runs next? Based on priority
Priority-Leveled Processes ,[object Object],[object Object],[object Object],[object Object],RL [ n ]
The Processes in  Ready List Status.Type      { running ,  ready_a ,  ready_s }
The Scheduler
The Scheduler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Scheduler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Some processes in  RL  can get CPU. Running processes may be  preempted . The  scheduler / dispatcher  should always keep the  np  (#processors)  highest-priority active processes  running.
Invoking the Scheduler ,[object Object],[object Object],[object Object]
Invoking the Scheduler ,[object Object],[object Object],[object Object]
An Embedded Scheduler Scheduler () {  do {  Find highest priority  ready_a  process p;  Find a free cpu;  if (cpu != NIL)  Allocate_CPU (p,cpu);  } while (cpu != NIL);  do {  Find highest priority  ready_a  process p;  Find lowest priority running process q;  if (Priority(p) > Priority(q))  Preempt (p,q);  } while (Priority(p) > Priority(q)); if (self->Status.Type!=’running’)  Preempt (p,self);  } ,[object Object],[object Object],[object Object],If free CPUs are available,  allocate  these free CPUs to high-priority processes in  ready_a  state To  preempt  low-priority  running  processes by high-priority  ready_a  ones. If the caller is going to be  idled ,  preempt   itself .
An Embedded Scheduler Scheduler () {  do {  Find highest priority  ready_a  process p;  Find a free  cpu ;  if ( cpu  != NIL)  Allocate_CPU (p, cpu );  } while ( cpu  != NIL);  do {  Find highest priority  ready_a  process p;  Find lowest priority running process q;  if (Priority(p) > Priority(q))  Preempt (p,q);  } while (Priority(p) > Priority(q)); if (self->Status.Type!=’running’)  Preempt (p,self);  } ,[object Object],[object Object],[object Object],To  preempt  low-priority  running  processes by high-priority  ready_a  ones. If the caller is going to be  idled ,  preempt   itself .
An Embedded Scheduler Scheduler () {  do {  Find highest priority  ready_a  process p;  Find a free  cpu ;  if ( cpu  != NIL)  Allocate_CPU (p, cpu );  } while ( cpu  != NIL);  do {  Find highest priority  ready_a  process p;  Find lowest priority  running  process q;  if (Priority(p)  >  Priority(q))  Preempt (p,q);  } while (Priority(p)  >  Priority(q)); if (self->Status.Type!=’running’)  Preempt (p,self);  } ,[object Object],[object Object],[object Object],If the caller is going to be  idled ,  preempt   itself .
An Embedded Scheduler Scheduler () {  do {  Find highest priority  ready_a  process p;  Find a free  cpu ;  if ( cpu  != NIL)  Allocate_CPU (p, cpu );  } while ( cpu  != NIL);  do {  Find highest priority  ready_a  process p;  Find lowest priority  running  process q;  if (Priority(p)  >  Priority(q))  Preempt (p,q);  } while (Priority(p)  >  Priority(q)); if (self->Status.Type != ’ running ’)  Preempt (p,self);  } ,[object Object],[object Object],[object Object]
An Embedded Scheduler Scheduler () {  do {  Find highest priority  ready_a  process p;  Find a free  cpu ;  if ( cpu  != NIL)  Allocate_CPU (p, cpu );  } while ( cpu  != NIL);  do {  Find highest priority  ready_a  process p;  Find lowest priority  running  process q;  if (Priority(p)  >  Priority(q))  Preempt (p,q);  } while (Priority(p)  >  Priority(q)); if (self->Status.Type != ’ running ’)  Preempt (p,self);  } How to  simplify  the scheduler for a  uniprocessor  system?
Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling Scheduling Methods
Scheduling Policy ,[object Object],[object Object],[object Object],[object Object],[object Object]
The General Framework ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],  Decision  Mode ,[object Object],[object Object],[object Object],A scheduling policy is determined by:
The Decision Modes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],A scheduling policy is determined by:
The Priority Function ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],A scheduling policy is determined by:
The Arbitration Rules ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],A scheduling policy is determined by:
Common Scheduling Algorithms ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example Processes for Scheduling ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],0 1 2 3 4 5 6 7 8 9 p 1 p 2
FIFO ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],0 1 2 3 4 5 6 7 8 9 p 1 p 2 CPU does other things Start Scheduling p 1 p 2
FIFO ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],0 1 2 3 4 5 6 7 8 9 p 1 p 2 CPU does other things Start Scheduling p 1 p 2
SJF ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],0 1 2 3 4 5 6 7 8 9 p 1 p 2 CPU does other things Start Scheduling p 1 p 2
SJF ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],0 1 2 3 4 5 6 7 8 9 p 1 p 2 CPU does other things Start Scheduling p 1 p 2
SRT ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],0 1 2 3 4 5 6 7 8 9 p 1 p 2 CPU does other things Start Scheduling p 1 p 2 p 1
SRT ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],0 1 2 3 4 5 6 7 8 9 p 1 p 2 CPU does other things Start Scheduling p 1 p 2 p 1
RR ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Assume a  time-quantum  of 0.1 time units. 0 1 2 3 4 5 6 7 8 9 p 1 p 2 CPU does other things Start Scheduling p 1 p 1 p 2 p 1
RR ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Assume a  time-quantum  of 0.1 time units. 0 1 2 3 4 5 6 7 8 9 p 1 p 2 CPU does other things Start Scheduling p 1 p 1 p 2 p 1
ML ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ML ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Each process has a  fixed  priority. 1 2 n     1 n front rear Lowest Highest
ML  (Nonpreemptive) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Each process has a  fixed  priority. 1 2 n     1 n front rear Lowest Highest
ML  (Preemptive) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Each process has a  fixed  priority. 1 2 n     1 n front rear Lowest Highest
ML  (Nonpreemptive) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],e p 1  = 15 e p 2  = 14 0 1 2 3 4 5 6 7 8 9 p 1 p 2 CPU does other things Start Scheduling p 1 p 2
MLF ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MLF ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],a : attained service time P  =  n  –  i  =  n  –   lg 2 ( a / T +1) 
MLF ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],a : attained service time P  =  n  –  i  =  n  –   lg 2 ( a / T +1) 
RM & EDF ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Common Scheduling Algorithms
Comparison of Methods ,[object Object],[object Object],[object Object],r i : the real time that the  i th  process spends in the system.
Example arrival service p 1 p 2 p 3 t t t    3 4 2 1 Comparison of average turnaround time
Comparison of Methods ,[object Object],[object Object],[object Object]
Comparison of Methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Interactive Systems ,[object Object],[object Object]
Comparison of Methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example: RM and EDF CPU Utilization 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 p 1 p 2 p 1 p 2 RM p 1 p 2 EDF
Example: RM and EDF CPU Utilization  fail 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 p 2 p 1 p 2 RM p 1 p 2 EDF p 1
Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling Priority Inversion
Priority Inversion Problem ,[object Object],[object Object],[object Object],p 1 P(mutex) CS_1 V(mutex) Program1 p 2 Program2 p 3 P(mutex) CS_3 V(mutex) Program3
Priority Inversion Problem ,[object Object],[object Object],[object Object]
Priority Inversion Problem ,[object Object],[object Object],[object Object],             
Priority Inversion Problem ,[object Object],[object Object],[object Object],              (Unrelated)  p 2  may delay  p 1   indefinitely .
Solutions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Dynamic Priority Inheritance ,[object Object],[object Object],[object Object],Sha, Rajkumar, and Lehocsky 1990 ,[object Object],[object Object],[object Object]
Dynamic Priority Inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Dynamic Priority Inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],             
References ,[object Object],[object Object],[object Object],[object Object]
Reading Assignment ,[object Object],[object Object]

More Related Content

What's hot (20)

CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
OSCh6
OSCh6OSCh6
OSCh6
 
Cpu scheduling(suresh)
Cpu scheduling(suresh)Cpu scheduling(suresh)
Cpu scheduling(suresh)
 
Cp usched 2
Cp usched  2Cp usched  2
Cp usched 2
 
Algorithm o.s.
Algorithm o.s.Algorithm o.s.
Algorithm o.s.
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
Sa by shekhar
Sa by shekharSa by shekhar
Sa by shekhar
 
Scheduling Algorithms
Scheduling AlgorithmsScheduling Algorithms
Scheduling Algorithms
 
Scheduling
SchedulingScheduling
Scheduling
 
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
 
Ch6
Ch6Ch6
Ch6
 
Chapter4
Chapter4Chapter4
Chapter4
 
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinComparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
cpu scheduling by shivam singh
cpu scheduling by shivam singhcpu scheduling by shivam singh
cpu scheduling by shivam singh
 

Viewers also liked

Ch11 input output systems
Ch11 input output systemsCh11 input output systems
Ch11 input output systemsissbp
 
Class5
 Class5 Class5
Class5issbp
 
Os4 2
Os4 2Os4 2
Os4 2issbp
 
Class9
 Class9 Class9
Class9issbp
 
Os2 2
Os2 2Os2 2
Os2 2issbp
 
Os6 2
Os6 2Os6 2
Os6 2issbp
 
Lecture 7: Definite Clause Grammars
Lecture 7: Definite Clause GrammarsLecture 7: Definite Clause Grammars
Lecture 7: Definite Clause GrammarsCS, NcState
 
Os10 2
Os10 2Os10 2
Os10 2issbp
 
Theory of Automata and formal languages Unit 5
Theory of Automata and formal languages Unit 5Theory of Automata and formal languages Unit 5
Theory of Automata and formal languages Unit 5Abhimanyu Mishra
 
Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...
Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...
Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...Animesh Chaturvedi
 
Pattern detection in mealy machine
Pattern detection in mealy machinePattern detection in mealy machine
Pattern detection in mealy machineAnimesh Chaturvedi
 
Class6
 Class6 Class6
Class6issbp
 
0227 regularlanguages
 0227 regularlanguages 0227 regularlanguages
0227 regularlanguagesissbp
 
Fundamental question and answer in cloud computing quiz by animesh chaturvedi
Fundamental question and answer in cloud computing quiz by animesh chaturvediFundamental question and answer in cloud computing quiz by animesh chaturvedi
Fundamental question and answer in cloud computing quiz by animesh chaturvediAnimesh Chaturvedi
 

Viewers also liked (20)

Ch11 input output systems
Ch11 input output systemsCh11 input output systems
Ch11 input output systems
 
Class5
 Class5 Class5
Class5
 
Os4 2
Os4 2Os4 2
Os4 2
 
Os6
Os6Os6
Os6
 
Class9
 Class9 Class9
Class9
 
Os2 2
Os2 2Os2 2
Os2 2
 
Os4
Os4Os4
Os4
 
Os6 2
Os6 2Os6 2
Os6 2
 
Os2
Os2Os2
Os2
 
Lecture 7: Definite Clause Grammars
Lecture 7: Definite Clause GrammarsLecture 7: Definite Clause Grammars
Lecture 7: Definite Clause Grammars
 
Design1
Design1Design1
Design1
 
Cspc final
Cspc finalCspc final
Cspc final
 
Os10 2
Os10 2Os10 2
Os10 2
 
Theory of Automata and formal languages Unit 5
Theory of Automata and formal languages Unit 5Theory of Automata and formal languages Unit 5
Theory of Automata and formal languages Unit 5
 
Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...
Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...
Automated Web Service Change Management (AWSCM) A tool published at IEEE Clou...
 
Pattern detection in mealy machine
Pattern detection in mealy machinePattern detection in mealy machine
Pattern detection in mealy machine
 
Os3
Os3Os3
Os3
 
Class6
 Class6 Class6
Class6
 
0227 regularlanguages
 0227 regularlanguages 0227 regularlanguages
0227 regularlanguages
 
Fundamental question and answer in cloud computing quiz by animesh chaturvedi
Fundamental question and answer in cloud computing quiz by animesh chaturvediFundamental question and answer in cloud computing quiz by animesh chaturvedi
Fundamental question and answer in cloud computing quiz by animesh chaturvedi
 

Similar to Os5 2

Process management in os
Process management in osProcess management in os
Process management in osMiong Lazaro
 
cpu sechduling
cpu sechduling cpu sechduling
cpu sechduling gopi7
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSMargrat C R
 
operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdfAliyanAbbas1
 
Window scheduling algorithm
Window scheduling algorithmWindow scheduling algorithm
Window scheduling algorithmBinal Parekh
 
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILED
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILEDCPU SCHEDULING IN OPERATING SYSTEMS IN DETAILED
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILEDVADAPALLYPRAVEENKUMA1
 
Scheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptxScheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptxRevathi Kmp
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentationusmankiyani1
 
CPU scheduling
CPU schedulingCPU scheduling
CPU schedulingAmir Khan
 
programming .pptx
programming .pptxprogramming .pptx
programming .pptxSHUJEHASSAN
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-schedulingNazir Ahmed
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesmanideepakc
 
scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .pptSaba651353
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System SchedulingVishnu Prasad
 

Similar to Os5 2 (20)

Process management in os
Process management in osProcess management in os
Process management in os
 
Scheduling
Scheduling Scheduling
Scheduling
 
cpu sechduling
cpu sechduling cpu sechduling
cpu sechduling
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdf
 
cpu scheduling.pdf
cpu scheduling.pdfcpu scheduling.pdf
cpu scheduling.pdf
 
Window scheduling algorithm
Window scheduling algorithmWindow scheduling algorithm
Window scheduling algorithm
 
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILED
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILEDCPU SCHEDULING IN OPERATING SYSTEMS IN DETAILED
CPU SCHEDULING IN OPERATING SYSTEMS IN DETAILED
 
Scheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptxScheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptx
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
 
CPU scheduling
CPU schedulingCPU scheduling
CPU scheduling
 
programming .pptx
programming .pptxprogramming .pptx
programming .pptx
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-scheduling
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processes
 
scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .ppt
 
OS ASSIGNMENT.pptx
OS ASSIGNMENT.pptxOS ASSIGNMENT.pptx
OS ASSIGNMENT.pptx
 
Shortest Job First
Shortest Job FirstShortest Job First
Shortest Job First
 
OS_Ch6
OS_Ch6OS_Ch6
OS_Ch6
 
Process management
Process managementProcess management
Process management
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
 

More from issbp

Os10
Os10Os10
Os10issbp
 
Os9 2
Os9 2Os9 2
Os9 2issbp
 
Os8 2
Os8 2Os8 2
Os8 2issbp
 
Os7 2
Os7 2Os7 2
Os7 2issbp
 
Os3 2
Os3 2Os3 2
Os3 2issbp
 
Class8
 Class8 Class8
Class8issbp
 
Class7
 Class7 Class7
Class7issbp
 
Class4
 Class4 Class4
Class4issbp
 
Class3
 Class3 Class3
Class3issbp
 
Class2
 Class2 Class2
Class2issbp
 
Class1
 Class1 Class1
Class1issbp
 

More from issbp (14)

Os10
Os10Os10
Os10
 
Os9 2
Os9 2Os9 2
Os9 2
 
Os9
Os9Os9
Os9
 
Os8 2
Os8 2Os8 2
Os8 2
 
Os8
Os8Os8
Os8
 
Os7 2
Os7 2Os7 2
Os7 2
 
Os7
Os7Os7
Os7
 
Os3 2
Os3 2Os3 2
Os3 2
 
Class8
 Class8 Class8
Class8
 
Class7
 Class7 Class7
Class7
 
Class4
 Class4 Class4
Class4
 
Class3
 Class3 Class3
Class3
 
Class2
 Class2 Class2
Class2
 
Class1
 Class1 Class1
Class1
 

Os5 2

  • 1. Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling 主講人:虞台文
  • 2.
  • 3. Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling Organization of Schedulers
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. The Processes in Ready List Status.Type  { running , ready_a , ready_s }
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. An Embedded Scheduler Scheduler () { do { Find highest priority ready_a process p; Find a free cpu ; if ( cpu != NIL) Allocate_CPU (p, cpu ); } while ( cpu != NIL); do { Find highest priority ready_a process p; Find lowest priority running process q; if (Priority(p) > Priority(q)) Preempt (p,q); } while (Priority(p) > Priority(q)); if (self->Status.Type != ’ running ’) Preempt (p,self); } How to simplify the scheduler for a uniprocessor system?
  • 20. Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling Scheduling Methods
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 46.
  • 47. Example arrival service p 1 p 2 p 3 t t t  3 4 2 1 Comparison of average turnaround time
  • 48.
  • 49.
  • 50.
  • 51.
  • 52. Example: RM and EDF CPU Utilization 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 p 1 p 2 p 1 p 2 RM p 1 p 2 EDF
  • 53. Example: RM and EDF CPU Utilization  fail 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 p 2 p 1 p 2 RM p 1 p 2 EDF p 1
  • 54. Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling Priority Inversion
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.