CS4315A. Berrached:CMS:UHD1 CPU Scheduling Chapter 7.

Slides:



Advertisements
Similar presentations
CPU Scheduling.
Advertisements

Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
OS, , Part II CPU Scheduling Department of Computer Engineering, PSUWannarat Suntiamorntut.
CPU Management CT213 – Computing Systems Organization.
SCHEDULING Kshama Desai Bijal Shah Kishore Putta Kashyap Sheth.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Chapter 6a: CPU Scheduling.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Operating Systems Chapter 6
Chap 5 Process Scheduling. Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU–I/O Burst Cycle – Process execution consists of a.
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
Scheduling in Batch Systems
Chapter 6: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 6: CPU Scheduling Basic.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 5-CPU Scheduling
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
Scheduling. Model of Process Execution Ready List Ready List Scheduler CPU Resource Manager Resource Manager Resources Preemption or voluntary yield AllocateRequest.
Chapter 6: CPU Scheduling
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 5 Operating Systems.
Chapter 4 Processor Management
CS212: OPERATING SYSTEM Lecture 3: Process Scheduling 1.
Scheduling Strategies Operating Systems Spring 2004 Class #10.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
Alternating Sequence of CPU And I/O Bursts. Histogram of CPU-burst Times.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 5 Processor Scheduling Introduction Processor (CPU) scheduling is the sharing of the processor(s) among the processes in the ready queue.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 5 CPU Scheduling Slide 1 Chapter 5 CPU Scheduling.
Slide 7-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 7.
CPU Scheduling Operating Systems CS 550. Last Time Deadlock Detection and Recovery Methods to handle deadlock – Ignore it! – Detect and Recover – Avoidance.
1 Uniprocessor Scheduling Chapter 3. 2 Alternating Sequence of CPU And I/O Bursts.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
Basic Concepts Maximum CPU utilization obtained with multiprogramming
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
CPU SCHEDULING.
Chapter 6: CPU Scheduling
Chapter 5a: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Process management Information maintained by OS for process management
CPU Scheduling Basic Concepts Scheduling Criteria
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Operating System Concepts
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter5: CPU Scheduling
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Outline Announcements Process Scheduling– continued
Outline Announcement Process Scheduling– continued
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling: Basic Concepts
Module 5: CPU Scheduling
Presentation transcript:

CS4315A. Berrached:CMS:UHD1 CPU Scheduling Chapter 7

CS4315A. Berrached:CMS:UHD2 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms – FCFS (FIFO) – SJN & SRTN – Priority Scheduling – Round Robin Scheduling –Multilevel Queue –Multilevel Feedback Queue

CS4315A. Berrached:CMS:UHD3 CPU Scheduling A multiprogramming OS allows more than one process to be loaded in main memory at a time. Processes share the CPU using time- multiplexing A process execution consists of a cycle of CPU computation--I/O operations. I/O operations require orders of magnitude more time to complete. Basic Idea: When the running process requests an I/O operation, allocate CPU to another process.

CS4315A. Berrached:CMS:UHD4 CPU Scheduler CPU Scheduler: that part of the Process Manager than is responsible for –handling removal of running process from CPU –Selection of another process Two major issues: Scheduling mechanism: how is it all done? Scheduling policy: –when is it time for a process to be removed from CPU? –Which ready process should be allocated the CPU next?

CS4315A. Berrached:CMS:UHD5 Scheduling Mechanism

CS4315A. Berrached:CMS:UHD6 Scheduling Mechanism CNTD Three parts: –enqueuer –dispatcher – context-switcher Data Structures: –Process Descriptor –Ready List

CS4315A. Berrached:CMS:UHD7 Scheduling Mechanism CNTD When a process is moved to the Ready-List –Process Descriptor (PD) is updated –the enqueuer places a pointer to PD in the Ready-List When the Scheduler switches CPU from one process to another process –the Context-Switcher saves the state of the current process in its PD. How context-switching occurs depends on how CPU multiplexing technique used: –voluntary multiplexing –involuntary multiplexing

CS4315A. Berrached:CMS:UHD8 Scheduling Mechanism CNTD Voluntary multiplexing: Running process gives up CPU voluntarily –context-switcher is invoked by running process. Involuntary multiplexing: an interrupt causes running process to be removed from CPU. –Interrupt generated by an I/O operation requested by another process. –Most commonly: a timer generated interrupt. –In either case, interrupt handler invokes context- switcher.

CS4315A. Berrached:CMS:UHD9 Scheduling Mechanism--Dispatcher After state of "old" process is saved by context- switcher, the CPU is allocated to the Dispatcher –Dispatcher state is loaded on CPU Dispatcher selects one of the ready processes enqueued in the Ready-List. Dispatcher performs another context-switch from itself to selected process (saves its state and loads state of selected process). The Process Descriptor of selected process is changed from Ready to Running.

CS4315A. Berrached:CMS:UHD10 Process Scheduling

CS4315A. Berrached:CMS:UHD11 Scheduling Policy Criteria

CS4315A. Berrached:CMS:UHD12 Optimization Criteria

CS4315A. Berrached:CMS:UHD13 First-Come-First-Served (FCFS) Scheduling

CS4315A. Berrached:CMS:UHD14 FCFS Scheduling (cont.)

CS4315A. Berrached:CMS:UHD15 Shortest-Job-Next (SJN) Scheduling SJN is optimal – gives minimum average waiting time for a given set of processes

CS4315A. Berrached:CMS:UHD16 Example of Non-Preemptive SJN 2.0

CS4315A. Berrached:CMS:UHD17 Example of Preemptive SJN 2.0

CS4315A. Berrached:CMS:UHD18 Priority Scheduling

CS4315A. Berrached:CMS:UHD19 Round Robin (RR) Scheduling

CS4315A. Berrached:CMS:UHD20 Example: RR with time quantum=20

CS4315A. Berrached:CMS:UHD21 Deadline Scheduling Real Time Systems –Processes must complete their task by specific deadlines –Main performance criteria –Scheduler must have complete knowledge of service time of each process All function must be predictable– no virtual memory –A process is admitted to ready list only if OS can guarantee deadline can be met.

CS4315A. Berrached:CMS:UHD22 Example ProcessService TimeDeadline none

CS4315A. Berrached:CMS:UHD23 Multi-Level Queue Extension of priority scheduling, which also combines other strategies Ready list is partitioned into multiple sub-lists Each process is assigned to a queue based on some criteria (type, priority, etc.) –E.g. one Q for foreground processes and one for background processes Scheduler: * in-queue strategy * cross-queue strategy –E.g. In-queue strategy: RR for foreground Q and FCFS for background A –Cross-queue strategy: Serve higher-level processes first

CS4315A. Berrached:CMS:UHD24 Multi-Level Queue Example: –Cross-Queue Strategy: Each queue get a percentage of CPU time (in a round robin fashion) which it can schedule among its processes. –E.g. Level 1: 80% of CPU time Level 2: 20% of CPU time

CS4315A. Berrached:CMS:UHD25 Multi-Level Feedback Queue

CS4315A. Berrached:CMS:UHD26 Example:Multi-Level Feedback Queue Gives shorter jobs higher priority without needing to predict a job’s service time requirement.

CS4315A. Berrached:CMS:UHD27 BSD UNIX Scheduling Multiple-level feedback queue approach 32 queues System processes are placed in Q0 – Q7 User processes are placed in Q8 – Q31 Dispatcher always selects a process from highest priority queue to run RR is used in each queue (time slice varies but always < 100μs) A process’s changes over time: based on nice() system calls and process’s utilization of CPU.

CS4315A. Berrached:CMS:UHD28 Windows NT/2K Multiple-level feedback queues for thread scheduling Priority to those threads that need very rapid response 32 levels 16 highest priority Qs are called real-time level queues Next 15 Qs are variable-level queue Lowest priority Q is called system-level Q. System-level Q contains a single thread called zero-page thread. It is run only when there are no other runnable threads. Scheduling goes from highest level down Scheduling is preemptive: if a high-priority thread becomes runnable while a lower priority thread is running, the latter is preempted and the higher level thread will begin to use the processor