Presentation is loading. Please wait.

Presentation is loading. Please wait.

240-323 OS,2000 1 240-323, Part II CPU Scheduling Department of Computer Engineering, PSUWannarat Suntiamorntut.

Similar presentations


Presentation on theme: "240-323 OS,2000 1 240-323, Part II CPU Scheduling Department of Computer Engineering, PSUWannarat Suntiamorntut."— Presentation transcript:

1 240-323 OS,2000 1 240-323, Part II CPU Scheduling Department of Computer Engineering, PSUWannarat Suntiamorntut

2 240-323 OS,2000 2 Department of Computer Engineering, PSUWannarat Suntiamorntut Basic Concepts The basic problem is as follows: How can OS schedule the allocation of CPU cycles to processes in system, to achieve “good performance”? Scheduling is a fundamental OS function.

3 240-323 OS,2000 3 Department of Computer Engineering, PSUWannarat Suntiamorntut CPU- I/O Burst Cycle cpu burst I/O burst cpu burst I/O burst CPU burst I/O burst

4 240-323 OS,2000 4 Department of Computer Engineering, PSUWannarat Suntiamorntut Preemptive Scheduling process switches from running -> waiting (I/O request,.. ) process switches from running -> ready (interrupt occur) process switches from waiting -> ready (completion of I/O) process terminate

5 240-323 OS,2000 5 Department of Computer Engineering, PSUWannarat Suntiamorntut Dispatcher Module to give control of CPU to process selected by short-term scheduler. This function involves : - Switching context - Switching to user mode - Jumping to the proper location in user program to restart that program

6 240-323 OS,2000 6 Department of Computer Engineering, PSUWannarat Suntiamorntut Scheduling Criteria CPU utilization : in a real system, it range from 40 - 90 percents. Throughput : number of processes that are completed. Turnaround time : interval from time of submission to completion. Waiting time : time that a process spends waiting in ready queue. Response time : time from the submission of a request until the first response.

7 240-323 OS,2000 7 Department of Computer Engineering, PSUWannarat Suntiamorntut Scheduling Algorithms First-come, First-served Scheduling (FCFS) mange with FIFO ProcessBurst Time P124 P23 P33 P1 P2 P3 0242730 Average wait time = 17

8 240-323 OS,2000 8 Department of Computer Engineering, PSUWannarat Suntiamorntut FCFS ProcessBurst Time P124 P23 P33 0 3 630 P3 P2 P1 Average wait time = 3

9 240-323 OS,2000 9 Department of Computer Engineering, PSUWannarat Suntiamorntut Scheduling Algorithm Shortest-Job-First Scheduling mange with SJF, minimum average wait time ProcessBurst Time P16 P28 P37 P43 0 3 9 1624 P4 P1 P3 P2 Average wait time = 7

10 240-323 OS,2000 10 Department of Computer Engineering, PSUWannarat Suntiamorntut Shortest-remaining-time-First Scheduling mange with SJF, minimum average wait time ProcessArrival timeBurst Time P108 P214 P329 P435 0 1 5 10 1726 P1 P2 P4 P1P3 Average wait time = 6.5 Scheduling Algorithm

11 240-323 OS,2000 11 Department of Computer Engineering, PSUWannarat Suntiamorntut Scheduling Algorithm Priority Scheduling scheduling in term of high priority and low. ProcessBurst TimePriority P1103 P211 P323 P414 P552 P2 P5 P1 P3 P4 0 1 6 16 18 19 Average wait time = 8.2

12 240-323 OS,2000 12 Department of Computer Engineering, PSUWannarat Suntiamorntut Scheduling Algorithm Round-Robin Scheduling round-robin (RR), especially for time-sharing. - time quantum, time slice = small unit of time ProcessBurst Time P124 P23 P33 If time quantum = 4 P1 P2 P3P1 P1 P1 P1 P1 0 4 7 10 14 18 222630 Average wait time = 5.66

13 240-323 OS,2000 13 Department of Computer Engineering, PSUWannarat Suntiamorntut Scheduling Algorithm Multilevel Queue Scheduling System process Highest priority Interactive process Interactive editing process Bath process student process lowest priority

14 240-323 OS,2000 14 Department of Computer Engineering, PSUWannarat Suntiamorntut Scheduling Algorithm Multilevel Feedback Queue Scheduling Quantum = 8 Quantum = 16 FCFS

15 240-323 OS,2000 15 Department of Computer Engineering, PSUWannarat Suntiamorntut Scheduling Algorithm ProcessBurst TimePriorityArrival time P11030 P2512 P3433 P4145 P5327 Do the example

16 240-323 OS,2000 16 Department of Computer Engineering, PSUWannarat Suntiamorntut Next Lecture in Process Synchronization


Download ppt "240-323 OS,2000 1 240-323, Part II CPU Scheduling Department of Computer Engineering, PSUWannarat Suntiamorntut."

Similar presentations


Ads by Google