SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

Nyquist criterion for zero ISI
Nyquist criterion for zero ISINyquist criterion for zero ISI
Nyquist criterion for zero ISIGunasekara Reddy
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.Ravi Kumar Patel
 
IF Statement
IF StatementIF Statement
IF StatementYunis20
 
Serial Communication & Embedded System Interface
Serial Communication & Embedded System InterfaceSerial Communication & Embedded System Interface
Serial Communication & Embedded System InterfaceKUET
 
Round Robin Scheduling Algorithm
Round Robin Scheduling AlgorithmRound Robin Scheduling Algorithm
Round Robin Scheduling AlgorithmAdeel Rasheed
 
CPU scheduling
CPU schedulingCPU scheduling
CPU schedulingAmir Khan
 
Fault tolerance techniques for real time operating system
Fault tolerance techniques for real time operating systemFault tolerance techniques for real time operating system
Fault tolerance techniques for real time operating systemanujos25
 
Overview of sampling
Overview of samplingOverview of sampling
Overview of samplingSagar Kumar
 
Nyquist criterion for distortion less baseband binary channel
Nyquist criterion for distortion less baseband binary channelNyquist criterion for distortion less baseband binary channel
Nyquist criterion for distortion less baseband binary channelPriyangaKR1
 
Field Programmable Gate Array: Building Blocks and Interconnections
Field Programmable Gate Array: Building Blocks and InterconnectionsField Programmable Gate Array: Building Blocks and Interconnections
Field Programmable Gate Array: Building Blocks and InterconnectionsDr. Saravanakumar Umathurai
 
Semophores and it's types
Semophores and it's typesSemophores and it's types
Semophores and it's typesNishant Joshi
 
Chapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzChapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzGiulianoRanauro
 
Round robin scheduling
Round robin schedulingRound robin scheduling
Round robin schedulingRaghav S
 
Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)ritu98
 
Adaline madaline
Adaline madalineAdaline madaline
Adaline madalineNagarajan
 

Mais procurados (20)

Nyquist criterion for zero ISI
Nyquist criterion for zero ISINyquist criterion for zero ISI
Nyquist criterion for zero ISI
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
IF Statement
IF StatementIF Statement
IF Statement
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
 
Sudoku solve rmain
Sudoku solve rmainSudoku solve rmain
Sudoku solve rmain
 
Serial Communication & Embedded System Interface
Serial Communication & Embedded System InterfaceSerial Communication & Embedded System Interface
Serial Communication & Embedded System Interface
 
Round Robin Scheduling Algorithm
Round Robin Scheduling AlgorithmRound Robin Scheduling Algorithm
Round Robin Scheduling Algorithm
 
CPU scheduling
CPU schedulingCPU scheduling
CPU scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Fault tolerance techniques for real time operating system
Fault tolerance techniques for real time operating systemFault tolerance techniques for real time operating system
Fault tolerance techniques for real time operating system
 
Overview of sampling
Overview of samplingOverview of sampling
Overview of sampling
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronization
 
Arduino IDE
Arduino IDE Arduino IDE
Arduino IDE
 
Nyquist criterion for distortion less baseband binary channel
Nyquist criterion for distortion less baseband binary channelNyquist criterion for distortion less baseband binary channel
Nyquist criterion for distortion less baseband binary channel
 
Field Programmable Gate Array: Building Blocks and Interconnections
Field Programmable Gate Array: Building Blocks and InterconnectionsField Programmable Gate Array: Building Blocks and Interconnections
Field Programmable Gate Array: Building Blocks and Interconnections
 
Semophores and it's types
Semophores and it's typesSemophores and it's types
Semophores and it's types
 
Chapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzChapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatz
 
Round robin scheduling
Round robin schedulingRound robin scheduling
Round robin scheduling
 
Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)
 
Adaline madaline
Adaline madalineAdaline madaline
Adaline madaline
 

Último

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 

Último (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

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

Notas do Editor

  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)