Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 5 Scheduling. Today CPSC 457 - Tyson Kendon 20161 Updates Assignment 1 Assignment 2 Concept Review Scheduling Processes Concepts Algorithms.

Similar presentations


Presentation on theme: "Lecture 5 Scheduling. Today CPSC 457 - Tyson Kendon 20161 Updates Assignment 1 Assignment 2 Concept Review Scheduling Processes Concepts Algorithms."— Presentation transcript:

1 Lecture 5 Scheduling

2 Today CPSC 457 - Tyson Kendon 20161 Updates Assignment 1 Assignment 2 Concept Review Scheduling Processes Concepts Algorithms

3 Assignment 1 CPSC 457 - Tyson Kendon 20162

4 Assignment 2 CPSC 457 - Tyson Kendon 20163

5 Concept Overview CPSC 457 - Tyson Kendon 20164

6 Last Time CPSC 457 - Tyson Kendon 20165 Threads Processes Creation Implementation Termination Information Context Switching Split Execution from Resources Life Span

7 Scheduling Processes CPSC 457 - Tyson Kendon 20166 Scheduling Concepts Scheduling Timing Preemptive vs Nonpreemptive Types of Scheduling Algorithms Scheduling Algorithm Goals and Metrics Scheduling Algorithms First Come, First Served Shortest Job First Exponential Average Priority Scheduling Round-Robin Multi-Queue Scheduling And many more!

8 Scheduling Concepts CPSC 457 - Tyson Kendon 20167 Deciding when to schedule Defining process behaviour CPU Burst Length Deciding which process should be running Do we interrupt a process once it’s running Preemptive vs Nonpreemptive

9 Scheduling Goals and Metrics CPSC 457 - Tyson Kendon 20168 Policy Enforcement Fairness Balance Throughput Turnaround Time CPU Utilization Response Time Wait Time Proportionality Meeting Deadlines Predictability Real Time

10 Types of Scheduling Algorithm CPSC 457 - Tyson Kendon 20169 Batch Interactive Real Time

11 Scheduling Algorithms CPSC 457 - Tyson Kendon 201610 First Come, First Served Shortest Job First Priority Scheduling Round-Robin Multi-Queue Scheduling Guaranteed Scheduling Lottery Scheduling Fair-Share scheduling

12

13 First Come, First Served CPSC 457 - Tyson Kendon 201612 Algorithm As processes arrive to be scheduled, they are added to the end of the queue. When it’s time to schedule a new process, the scheduler picks the head of the queue.

14 First Come, First Served CPSC 457 - Tyson Kendon 201613 Comments Nonpreemptive Bad for an interactive system Turnaround and Wait Times based on the sequence of arrival Easy to program Tends to bunch up I/O bound processes

15 Shortest Job First CPSC 457 - Tyson Kendon 201614 Algorithm As processes arrive to be scheduled, they are added to the end of the queue. When it’s time to schedule a new process, the scheduler picks the process with the shortest CPU burst next.

16 Shortest Job First CPSC 457 - Tyson Kendon 201615 Problem We don’t know how long each CPU burst is going to be. But we’re good at estimating things:

17 Exponential Average for CPU Burst Time CPSC 457 - Tyson Kendon 201616 ♣ n+1 = ♥ t n + (1 - ♥ ) ♣ n Powerpoint on mac… ♣ t n - the actual burst time for the n th burst of the process ♣ n - the predicted burst time for the n th burst of the process ♥ - weight to bias the average more to the last burst or the history

18 Shortest Job First CPSC 457 - Tyson Kendon 201617 Comments Preemptive or Nonpreemptive Can lead to starvation Provably optimal (if all jobs arrive at the same time) Slightly harder to program Need to implement burst estimation and track for processes

19 Priority Scheduling CPSC 457 - Tyson Kendon 201618 Algorithm Processes are assigned different priorities (somehow) A process is added to the queue for it’s priority The scheduler selects (fcfs, sjf or someotherway) from all of the processes in the highest priority queue

20 Priority Scheduling CPSC 457 - Tyson Kendon 201619 Comments Preemptive or Nonpreemptive Can lead to starvation We can use aging to stave off starvation Adheres to system policy Still fairly easy to implement

21 Round Robin CPSC 457 - Tyson Kendon 201620 Algorithm Start with FCFS Preempt processes after a fixed amount of CPU time (called the Time Quantum or the Time Slice) If you stopped a process for using all of it’s time, put it on the back of the queue.

22 Round Robin CPSC 457 - Tyson Kendon 201621 Comments Preemptive Have to factor in context switch time We can adjust the quantum to alter the behaviour of the system Generally want the quantum to long enough that the majority of processes (I/O bound) finish within it

23 Where Next? CPSC 457 - Tyson Kendon 201622 More Scheduling Real World Implementations Memory Management


Download ppt "Lecture 5 Scheduling. Today CPSC 457 - Tyson Kendon 20161 Updates Assignment 1 Assignment 2 Concept Review Scheduling Processes Concepts Algorithms."

Similar presentations


Ads by Google