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 OS, , Part II CPU Scheduling Department of Computer Engineering, PSUWannarat Suntiamorntut

2 OS, 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 OS, 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 OS, 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 OS, 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 OS, Department of Computer Engineering, PSUWannarat Suntiamorntut Scheduling Criteria CPU utilization : in a real system, it range from 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 OS, Department of Computer Engineering, PSUWannarat Suntiamorntut Scheduling Algorithms First-come, First-served Scheduling (FCFS) mange with FIFO ProcessBurst Time P124 P23 P33 P1 P2 P Average wait time = 17

8 OS, Department of Computer Engineering, PSUWannarat Suntiamorntut FCFS ProcessBurst Time P124 P23 P P3 P2 P1 Average wait time = 3

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

10 OS, Department of Computer Engineering, PSUWannarat Suntiamorntut Shortest-remaining-time-First Scheduling mange with SJF, minimum average wait time ProcessArrival timeBurst Time P108 P214 P329 P P1 P2 P4 P1P3 Average wait time = 6.5 Scheduling Algorithm

11 OS, 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 P Average wait time = 8.2

12 OS, 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 P Average wait time = 5.66

13 OS, 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 OS, Department of Computer Engineering, PSUWannarat Suntiamorntut Scheduling Algorithm Multilevel Feedback Queue Scheduling Quantum = 8 Quantum = 16 FCFS

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

16 OS, 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