SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Nov 2nd 2012




                     Julian Ilham
    Dept. of Electronic Engineering
      Pukyong National University
    Email: ilham.julian@gmail.com

1
 Introduction
 Preemptive vs Non-Preemptive

 First Come First Served (FCFS)
 Shortest Job First (SJF)
 Priority Based Scheduling
 Round Robin (RR)




                                   2
What is scheduling?

       Choosing which task to run and for how long




                     Why do we need it?


- Improve the system performance
- Support multitasking




                            3
Running task can be forced to release even
  Preemptive
                        though it is neither completed


                   Each running task keeps processing until it
Non - Preemptive
                                  completed




                                4
 Only available in Non-Preemptive mode
 Example:
                 Tasks           Arrival Times (ms)    Burst Time (ms)
                  P2                    0.0                  12
                  P3                    3.0                  8
                  P4                    5.0                  4
                  P1                   10.0                  10
                  P5                   12.0                  6


 Gantt chart
                 P2              P3         P4        P1          P5
         0                            20         24          34          40   (ms)
                3 5      10 12

                                        5
 Time Calculation
      P1 : 24 – 10 = 12 ms
      P2 : 0 ms
      P3 : 12 – 3 = 9 ms
      P4 : 20 – 5 = 15 ms
      P5 : 34 – 12 = 22 ms

Total waiting time : P1 + P2 + P3 + P4 + P5 = 58 ms
Average waiting time : 58 ms / 5 = 11.6 ms



                               6
 Advantage: Very simple code and structure

 Disadvantage: Large average waiting time




                             7
 Available in Preemptive and Non-Preemptive mode
 Example (Preemptive)
                     Tasks                Arrival Times (ms)     Burst Time (ms)
                         P2                         0.0                12
                         P3                         3.0                   8
                         P4                         5.0                   4
                         P1                         10.0               10
                         P5                         12.0                  6


 Gantt chart
           P2       P3        P4         P3           P5        P2            P1
       0                           9           15          21        30            40   (ms)
                3        5             10 12


                                                8
 Time Calculation (Preemptive)
      P1 : 30 – 10 = 20 ms
      P2 : 0 + (21 – 3) = 18 ms
      P3 : (3 – 3) + (9 – 5) = 4 ms
      P4 : 5 – 5 = 0 ms
      P5 : 15 – 12 = 3 ms

Total waiting time : P1 + P2 + P3 + P4 + P5 = 45 ms
Average waiting time : 45 ms / 5 = 9 ms



                                9
 Example (Non-Preemptive)
                Tasks           Arrival Times (ms)         Burst Time (ms)
                 P2                        0.0                   12
                 P3                        3.0                   8
                 P4                        5.0                   4
                 P1                       10.0                   10
                 P5                       12.0                   6

 Gantt chart
                 P2             P4         P5         P3              P1
       0                             16          22         30               40   (ms)
            3    5      10 12



                                          10
 Time Calculation (Non-Preemptive)
      P1 : 30 – 10 = 20 ms
      P2 : 0 ms
      P3 : 22 – 3 = 19 ms
      P4 : 12 – 5 = 7 ms
      P5 : 16 – 12 = 4 ms

Total waiting time : P1 + P2 + P3 + P4 + P5 = 50 ms
Average waiting time : 50 ms / 5 = 10 ms



                               11
 Advantage: Minimum average waiting time for a given set of
  process

 Disadvantage: Difficult to estimate burst time, starvation
  (indefinite blocking)




                               12
 Available in Preemptive and Non-Preemptive mode
 Example (Preemptive)
           Tasks        Arrival Times (ms)        Burst Time (ms)    Priority
            P2                  0.0                     12              2
            P3                  3.0                     8               5
            P4                  5.0                     4               1
            P1                  10.0                    10              4
            P5                  12.0                    6               3

 Gantt chart
           P2          P4       P2           P5          P1            P3
       0                  9            16         22            32              40   (ms)
            3      5    10 12

                                            13
 Time Calculation (Preemptive)
      P1 : 22 – 10 = 12 ms
      P2 : 9 – 5 = 4 ms
      P3 : 32 – 3 = 29 ms
      P4 : 5 – 5 = 0 ms
      P5 : 16 – 12 = 4 ms

Total waiting time : P1 + P2 + P3 + P4 + P5 = 49 ms
Average waiting time : 49 ms / 5 = 9.8 ms



                               14
 Example (Non-Preemptive)

           Tasks       Arrival Times (ms)      Burst Time (ms)    Priority
            P2                 0.0                   12              2
            P3                 3.0                   8               5
            P4                 5.0                   4               1
            P1                 10.0                  10              4
            P5                 12.0                  6               3

 Gantt chart
                 P2            P4         P5          P1            P3
                                     16        22            32              40   (ms)
            3      5   10 12


                                          15
 Time Calculation (Non-Preemptive)
      P1 : 22 – 10 = 12 ms
      P2 : 0 ms
      P3 : 32 – 3 = 29 ms
      P4 : 12 – 5 = 7 ms
      P5 : 16 – 12 = 4 ms

Total waiting time : P1 + P2 + P3 + P4 + P5 = 52 ms
Average waiting time : 52 ms / 5 = 10.4 ms



                               16
 Advantage: Easier than SJF

 Disadvantage: Can cause indefinite blocking




                               17
 Only available in Non-Preemptive mode
 FCFS is used in sequencing policy
 Need to determine time slice/ quantum as a unit of time for
  each process
 Then continue to the next process after reaching maximum of
  quantum


  - Too small time quantum -> too many tasks switched
  - Too large time quantum -> inherits the problem of FCFS




                             18
 Example (assuming quantum is 5 ms):

                  Tasks            Arrival Times (ms)        Burst Time (ms)
                   P2                        0.0                       12
                   P3                        3.0                       8
                   P4                        5.0                       4
                   P1                       10.0                       10
                   P5                       12.0                       6

 Gantt chart
0        5        10         14        19          24        29        32        37 38   40
    P2       P3         P4        P1         P5         P2        P3        P1     P5 P2


    3    5        10 12


                                            19
 Time Calculation
      P1 : (14 – 10) + (32 – 19) = 17 ms
      P2 : 0 + (24 – 5) + (38 – 29) = 28 ms
      P3 : (5 – 3) + (29 – 10) = 21 ms
      P4 : 10 – 5 = 5 ms
      P5 : (19 – 12) + (37 – 24) = 20 ms

Total waiting time : P1 + P2 + P3 + P4 + P5 = 91 ms
Average waiting time : 91 ms / 5 = 18.2 ms



                               20
 Advantage: Guarantee fairness (bounded waiting time and no
  starvation)

 Disadvantage: Average waiting time is long




                              21
Q n A




 22

Weitere ähnliche Inhalte

Was ist angesagt?

CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithmsShanu Kumar
 
Computer Systems Organization
Computer Systems OrganizationComputer Systems Organization
Computer Systems OrganizationLiEdo
 
Priority driven scheduling of periodic tasks
Priority driven scheduling of periodic tasksPriority driven scheduling of periodic tasks
Priority driven scheduling of periodic tasksKamal Acharya
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.Ravi Kumar Patel
 
Computer architecture multi processor
Computer architecture multi processorComputer architecture multi processor
Computer architecture multi processorMazin Alwaaly
 
Process management in os
Process management in osProcess management in os
Process management in osMiong Lazaro
 
Real time Scheduling in Operating System for Msc CS
Real time Scheduling in Operating System for Msc CSReal time Scheduling in Operating System for Msc CS
Real time Scheduling in Operating System for Msc CSThanveen
 
SFO15-200: Linux kernel generic TEE driver
SFO15-200: Linux kernel generic TEE driverSFO15-200: Linux kernel generic TEE driver
SFO15-200: Linux kernel generic TEE driverLinaro
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Mukesh Chinta
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process SchedulingDamian T. Gordon
 
Real time operating system
Real time operating systemReal time operating system
Real time operating systemKhuram Shahzad
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 

Was ist angesagt? (20)

CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
 
Computer Systems Organization
Computer Systems OrganizationComputer Systems Organization
Computer Systems Organization
 
Operating System Scheduling Algorithms
Operating System Scheduling AlgorithmsOperating System Scheduling Algorithms
Operating System Scheduling Algorithms
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
Real Time Systems
Real Time SystemsReal Time Systems
Real Time Systems
 
Priority driven scheduling of periodic tasks
Priority driven scheduling of periodic tasksPriority driven scheduling of periodic tasks
Priority driven scheduling of periodic tasks
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
Computer architecture multi processor
Computer architecture multi processorComputer architecture multi processor
Computer architecture multi processor
 
Process management in os
Process management in osProcess management in os
Process management in os
 
Real time Scheduling in Operating System for Msc CS
Real time Scheduling in Operating System for Msc CSReal time Scheduling in Operating System for Msc CS
Real time Scheduling in Operating System for Msc CS
 
SFO15-200: Linux kernel generic TEE driver
SFO15-200: Linux kernel generic TEE driverSFO15-200: Linux kernel generic TEE driver
SFO15-200: Linux kernel generic TEE driver
 
Shortest Job First
Shortest Job FirstShortest Job First
Shortest Job First
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
 
Real time operating system
Real time operating systemReal time operating system
Real time operating system
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 

Kürzlich hochgeladen

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Kürzlich hochgeladen (20)

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

Scheduling Algorithms

  • 1. Nov 2nd 2012 Julian Ilham Dept. of Electronic Engineering Pukyong National University Email: ilham.julian@gmail.com 1
  • 2.  Introduction  Preemptive vs Non-Preemptive  First Come First Served (FCFS)  Shortest Job First (SJF)  Priority Based Scheduling  Round Robin (RR) 2
  • 3. What is scheduling? Choosing which task to run and for how long Why do we need it? - Improve the system performance - Support multitasking 3
  • 4. Running task can be forced to release even Preemptive though it is neither completed Each running task keeps processing until it Non - Preemptive completed 4
  • 5.  Only available in Non-Preemptive mode  Example: Tasks Arrival Times (ms) Burst Time (ms) P2 0.0 12 P3 3.0 8 P4 5.0 4 P1 10.0 10 P5 12.0 6  Gantt chart P2 P3 P4 P1 P5 0 20 24 34 40 (ms) 3 5 10 12 5
  • 6.  Time Calculation P1 : 24 – 10 = 12 ms P2 : 0 ms P3 : 12 – 3 = 9 ms P4 : 20 – 5 = 15 ms P5 : 34 – 12 = 22 ms Total waiting time : P1 + P2 + P3 + P4 + P5 = 58 ms Average waiting time : 58 ms / 5 = 11.6 ms 6
  • 7.  Advantage: Very simple code and structure  Disadvantage: Large average waiting time 7
  • 8.  Available in Preemptive and Non-Preemptive mode  Example (Preemptive) Tasks Arrival Times (ms) Burst Time (ms) P2 0.0 12 P3 3.0 8 P4 5.0 4 P1 10.0 10 P5 12.0 6  Gantt chart P2 P3 P4 P3 P5 P2 P1 0 9 15 21 30 40 (ms) 3 5 10 12 8
  • 9.  Time Calculation (Preemptive) P1 : 30 – 10 = 20 ms P2 : 0 + (21 – 3) = 18 ms P3 : (3 – 3) + (9 – 5) = 4 ms P4 : 5 – 5 = 0 ms P5 : 15 – 12 = 3 ms Total waiting time : P1 + P2 + P3 + P4 + P5 = 45 ms Average waiting time : 45 ms / 5 = 9 ms 9
  • 10.  Example (Non-Preemptive) Tasks Arrival Times (ms) Burst Time (ms) P2 0.0 12 P3 3.0 8 P4 5.0 4 P1 10.0 10 P5 12.0 6  Gantt chart P2 P4 P5 P3 P1 0 16 22 30 40 (ms) 3 5 10 12 10
  • 11.  Time Calculation (Non-Preemptive) P1 : 30 – 10 = 20 ms P2 : 0 ms P3 : 22 – 3 = 19 ms P4 : 12 – 5 = 7 ms P5 : 16 – 12 = 4 ms Total waiting time : P1 + P2 + P3 + P4 + P5 = 50 ms Average waiting time : 50 ms / 5 = 10 ms 11
  • 12.  Advantage: Minimum average waiting time for a given set of process  Disadvantage: Difficult to estimate burst time, starvation (indefinite blocking) 12
  • 13.  Available in Preemptive and Non-Preemptive mode  Example (Preemptive) Tasks Arrival Times (ms) Burst Time (ms) Priority P2 0.0 12 2 P3 3.0 8 5 P4 5.0 4 1 P1 10.0 10 4 P5 12.0 6 3  Gantt chart P2 P4 P2 P5 P1 P3 0 9 16 22 32 40 (ms) 3 5 10 12 13
  • 14.  Time Calculation (Preemptive) P1 : 22 – 10 = 12 ms P2 : 9 – 5 = 4 ms P3 : 32 – 3 = 29 ms P4 : 5 – 5 = 0 ms P5 : 16 – 12 = 4 ms Total waiting time : P1 + P2 + P3 + P4 + P5 = 49 ms Average waiting time : 49 ms / 5 = 9.8 ms 14
  • 15.  Example (Non-Preemptive) Tasks Arrival Times (ms) Burst Time (ms) Priority P2 0.0 12 2 P3 3.0 8 5 P4 5.0 4 1 P1 10.0 10 4 P5 12.0 6 3  Gantt chart P2 P4 P5 P1 P3 16 22 32 40 (ms) 3 5 10 12 15
  • 16.  Time Calculation (Non-Preemptive) P1 : 22 – 10 = 12 ms P2 : 0 ms P3 : 32 – 3 = 29 ms P4 : 12 – 5 = 7 ms P5 : 16 – 12 = 4 ms Total waiting time : P1 + P2 + P3 + P4 + P5 = 52 ms Average waiting time : 52 ms / 5 = 10.4 ms 16
  • 17.  Advantage: Easier than SJF  Disadvantage: Can cause indefinite blocking 17
  • 18.  Only available in Non-Preemptive mode  FCFS is used in sequencing policy  Need to determine time slice/ quantum as a unit of time for each process  Then continue to the next process after reaching maximum of quantum - Too small time quantum -> too many tasks switched - Too large time quantum -> inherits the problem of FCFS 18
  • 19.  Example (assuming quantum is 5 ms): Tasks Arrival Times (ms) Burst Time (ms) P2 0.0 12 P3 3.0 8 P4 5.0 4 P1 10.0 10 P5 12.0 6  Gantt chart 0 5 10 14 19 24 29 32 37 38 40 P2 P3 P4 P1 P5 P2 P3 P1 P5 P2 3 5 10 12 19
  • 20.  Time Calculation P1 : (14 – 10) + (32 – 19) = 17 ms P2 : 0 + (24 – 5) + (38 – 29) = 28 ms P3 : (5 – 3) + (29 – 10) = 21 ms P4 : 10 – 5 = 5 ms P5 : (19 – 12) + (37 – 24) = 20 ms Total waiting time : P1 + P2 + P3 + P4 + P5 = 91 ms Average waiting time : 91 ms / 5 = 18.2 ms 20
  • 21.  Advantage: Guarantee fairness (bounded waiting time and no starvation)  Disadvantage: Average waiting time is long 21
  • 22. Q n A 22

Hinweis der Redaktion

  1. Today, I am going to present about scheduling algoritmScheduling algorithm is method inside the operating system in order to manage many tasks
  2. There are two types of scheduling methodPreemptive = can be interruptedNon-Preemptive = New task can be run after the current task is finished (can not be interrupted)
  3. Also well known as First in First out (FIFO)