SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Tendances (20)

CPU Non-Preemptive Scheduling
CPU Non-Preemptive Scheduling CPU Non-Preemptive Scheduling
CPU Non-Preemptive Scheduling
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptx
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
First Come First Serve
First Come First ServeFirst Come First Serve
First Come First Serve
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
Priority Scheduling
Priority Scheduling  Priority Scheduling
Priority Scheduling
 
Interrupts ppt
Interrupts pptInterrupts ppt
Interrupts ppt
 
Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithms
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space management
 
Real-Time Operating Systems
Real-Time Operating SystemsReal-Time Operating Systems
Real-Time Operating Systems
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
6 multiprogramming & time sharing
6 multiprogramming & time sharing6 multiprogramming & time sharing
6 multiprogramming & time sharing
 
Real time scheduling - basic concepts
Real time scheduling - basic conceptsReal time scheduling - basic concepts
Real time scheduling - basic concepts
 

Dernier

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
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
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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 Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Dernier (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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)
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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 Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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...
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

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

Notes de l'éditeur

  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)