Windows 2000 Scheduling Computing Department, Lancaster University, UK.

Slides:



Advertisements
Similar presentations
CPU Scheduling Tanenbaum Ch 2.4 Silberchatz and Galvin Ch 5.
Advertisements

Operating Systems Process Scheduling (Ch 3.2, )
1 Uniprocessor Scheduling Types of scheduling –The aim of processor scheduling is to assign processes to be executed by the processor so as to optimize.
李盈賢.  Start a process with a specific priority class  Methods: 1)Cmd: start /’priority’ ‘filename’ 2)Create a shortcut.
 A quantum is the amount of time a thread gets to run before Windows checks.  Length: Windows 2000 / XP: 2 clock intervals Windows Server systems: 12.
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.
CPU Scheduling CS 3100 CPU Scheduling1. Objectives To introduce CPU scheduling, which is the basis for multiprogrammed operating systems To describe various.
计算机系 信息处理实验室 Lecture 8 Processes, Threads, and Jobs (2)
CPU Scheduling Section 2.5.
Chapter 3: CPU Scheduling
Operating System Process Scheduling (Ch 4.2, )
Operating System I Process Scheduling. Schedulers F Short-Term –“Which process gets the CPU?” –Fast, since once per 100 ms F Long-Term (batch) –“Which.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling The key to multiprogramming is scheduling Scheduling is done to meet the goals of –Response time.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
Job scheduling Queue discipline.
Operating Systems Process Scheduling (Ch 4.2, )
1 Inside the Windows NT Scheduler, Part 1 Assigning CPU time in a uniprocessor environment by Mark Russinovich Windows NT Magazine - July 1997 Inside the.
Operating System Process Scheduling (Ch 4.2, )
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Process Scheduling in Windows XP, Linux, and UNIX By Sarah G. Levinson CSC 4320.
Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Scheduling in Windows Zoltan Micskei
Chapter 5: CPU Scheduling (Continuation). 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Determining Length.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Cosc 4740 Chapter 5 Process Scheduling. CPU Scheduling Short-term Scheduler –Selects a process from the ready queue when current process releases the.
Scheduling in Linux and Windows 2000
Chapter 6: CPU Scheduling
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 5 Operating Systems.
Windows OS Internals - Copyright © 2005 David A. Solomon, Mark E. Russinovich, and Andreas Polze Unit OS4: Scheduling and Dispatch 4.4. Windows Thread.
OPERATING SYSTEMS CPU SCHEDULING.  Introduction to CPU scheduling Introduction to CPU scheduling  Dispatcher Dispatcher  Terms used in CPU scheduling.
Operating System Examples - Scheduling
1 Previous lecture review n Out of basic scheduling techniques none is a clear winner: u FCFS - simple but unfair u RR - more overhead than FCFS may not.
Windows 2000 Course Summary Computing Department, Lancaster University, UK.
Operating Systems Process Management.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
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.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS4: Scheduling and Dispatch 4.5. Advanced Windows.
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.
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 3.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
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.
Operating Systems Unit 5: – Processor scheduling – Java – Linux – Windows XP Operating Systems.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
Operating System Examples - Scheduling. References r er/ch10.html r bangalore.org/blug/meetings/200401/scheduler-
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
Basic Concepts Maximum CPU utilization obtained with multiprogramming
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
 In a single-processor system, only one process can run at a time; any others must wait until the CPU is free and can be rescheduled.  The objective.
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 6: CPU Scheduling.
CPU Scheduling Scheduling processes (or kernel-level threads) onto the cpu is one of the most important OS functions. The cpu is an expensive resource.
UNIT–II: Process Management
Chapter 6: CPU Scheduling
CPU Scheduling Basic Concepts Scheduling Criteria
Chapter 6: CPU Scheduling
TDC 311 Process Scheduling.
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
CPU SCHEDULING.
Process Scheduling Decide which process should run and for how long
Chapter 10 Multiprocessor and Real-Time Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Presentation transcript:

Windows 2000 Scheduling Computing Department, Lancaster University, UK

Overview Goals Goals –Scheduling Scheduling concepts Scheduling concepts Thread priority levels Thread priority levels Multiprocessor support Multiprocessor support

Scheduling Multiple threads may be ready to run… Multiple threads may be ready to run… –Who gets to use the CPU? From Win32 point of view: From Win32 point of view: –Processes are given a priority class upon creation Idle, Below Normal, Normal, Above Normal, High, Realtime Idle, Below Normal, Normal, Above Normal, High, Realtime –Threads have a relative priority within the class Idle, Lowest, Below_Normal, Normal, Above_Normal, Highest, Time_Critical Idle, Lowest, Below_Normal, Normal, Above_Normal, Highest, Time_Critical

Scheduling (2) To the Windows 2000 scheduler: To the Windows 2000 scheduler: –Concern is with threads not processes i.e. threads are scheduled, not processes i.e. threads are scheduled, not processes –Threads have priorities 0 through i 16 “real-time” levels 15 variable levels Used by zero page thread Used by idle thread(s)

Win32 versus Kernel Priorities RealTimeHigh Above Normal Normal Below Normal Idle Time-critical Highest Above-normal Normal Below-Normal Lowest Idle Win32 Process Classes Win32 Thread Priorities

Manual Process Priority Adjustments

Win32 Scheduling-related APIs Get/SetPriorityClass Get/SetPriorityClass Get/SetThreadPriority – relative to its process base priority Get/SetThreadPriority – relative to its process base priority Get/SetProcessAffinityMask Get/SetProcessAffinityMask SetThreadAffinityMask – must be a subset of the process’s affinity mask SetThreadAffinityMask – must be a subset of the process’s affinity mask SetThreadIdealProcessor – Establishes a “preferred” processor SetThreadIdealProcessor – Establishes a “preferred” processor Get/SetProcessPriorityBoost Get/SetProcessPriorityBoost Suspend/ResumeThread Suspend/ResumeThread

Thread Scheduling Strictly priority driven Strictly priority driven –32 queues (FIFO lists) of ready threads One queue for each priority level One queue for each priority level Queues are common to all CPUs Queues are common to all CPUs –When thread becomes ready, it: either runs immediately, or either runs immediately, or is inserted at the tail end of the Ready queue for its current priority is inserted at the tail end of the Ready queue for its current priority –On a uniprocessor, highest priority Ready thread always runs Time-sliced, round-robin within a priority level Time-sliced, round-robin within a priority level

Thread Scheduling Multiprocessor Issues On a multiprocessor, highest-priority n threads will always run (subject to Affinity, see later) On a multiprocessor, highest-priority n threads will always run (subject to Affinity, see later) No attempt is made to share processors “fairly” among processes, only among threads No attempt is made to share processors “fairly” among processes, only among threads Tries to keep threads on the same CPU Tries to keep threads on the same CPU

Scheduling Scenarios Preemption Preemption –A thread becomes ready at a higher priority than the running thread Lower-priority thread is preempted Lower-priority thread is preempted Preempted thread goes to the head of its Ready queue Preempted thread goes to the head of its Ready queue –Strictly event-driven Does not wait for the next clock tick Does not wait for the next clock tick No guaranteed execution period before preemption No guaranteed execution period before preemption

Scheduling Scenarios (2) Voluntary switch Voluntary switch –When the running thread gives up the CPU Waiting on a dispatcher object Waiting on a dispatcher object Termination Termination Explicit lowering of priority Explicit lowering of priority –Schedule the thread at the head of the next non- empty Ready queue Running thread experiences quantum end Running thread experiences quantum end –Priority is decremented unless at thread base priority –Thread goes to tail of Ready queue for its new priority –May continue running if no equal or higher-priority threads are Ready – ie. it “gets” the new quantum

Quantum Details Standard quantum is two clock ticks Standard quantum is two clock ticks –12 on NT Server If normal-priority process owns the foreground window, its threads may be given a longer quantum If normal-priority process owns the foreground window, its threads may be given a longer quantum Windows 2000 has the ability to choose Workstation quantums on Server (and vice versa) Windows 2000 has the ability to choose Workstation quantums on Server (and vice versa)

Thread Scheduling States Init (0) – Thread is “under construction” Init (0) – Thread is “under construction” Ready (1) – thread eligible to be scheduled to run Ready (1) – thread eligible to be scheduled to run Running (2) Running (2) Standby (3) – thread is selected to run on CPU Standby (3) – thread is selected to run on CPU Terminate (4) – thread has executed its last code, but must wait till all references to it are closed Terminate (4) – thread has executed its last code, but must wait till all references to it are closed Waiting (5) – wait for one or multiple objects, after a voluntary switch Waiting (5) – wait for one or multiple objects, after a voluntary switch Transition (6) – thread was in a wait entered from user mode for 12 seconds or more, system was short of physical memory? Transition (6) – thread was in a wait entered from user mode for 12 seconds or more, system was short of physical memory?

Watching the Scheduler Demo… Demo… CPU Stress and Performance Monitor – both available in Windows 2000 Resource Kit CPU Stress and Performance Monitor – both available in Windows 2000 Resource Kit Trying to show: Trying to show: –Priority of current thread –State of current thread

Priority Adjustments Threads in “dynamic” classes can have priority adjustments applied to them (Boost or Decay) Threads in “dynamic” classes can have priority adjustments applied to them (Boost or Decay) –Idle, Below Normal, Normal, Above Normal and High –Carried out upon wait completion –Used to avoid CPU starvation (see later slide) No automatic adjustments in “real-time” class No automatic adjustments in “real-time” class –Priority 16 and above –Scheduling is therefore “predictable” with respect to ther “real-time” threads Note though that this does not mean that there are absolute latency guarantees Note though that this does not mean that there are absolute latency guarantees

Priority Boosting Priority boost takes place after a wait Priority boost takes place after a wait –Occurs when a wait (usually I/O) is resolved Slow devices / long waits = big boost Slow devices / long waits = big boost Fast devices / short waits = small boost Fast devices / short waits = small boost –Boost is applied to thread’s base priority Does not go over priority 15 Does not go over priority 15 –Keeps I/O devices busy After boost: After boost: –Priority decays one level, followed by another quantum, continuing till at base priority

CPU Starvation Balance Set Manager looks for “starved” threads Balance Set Manager looks for “starved” threads –BSM is a thread running at priority 16, waking up once per second –Looks at threads that have been Ready for 4 seconds or more –Boosts up to 10 Ready threads per pass Special boost applied Special boost applied –Priority 15 –Quantum is doubled Does not apply in real-time range Does not apply in real-time range

Multiprocessor Support By default, threads can run on any available processor By default, threads can run on any available processor Soft affinity (introduced in NT 4.0) Soft affinity (introduced in NT 4.0) –Every thread has an “ideal processor” –When thread becomes ready: if “ideal” is idle, it runs there if “ideal” is idle, it runs there else, if previous processor is idle, it runs there else, if previous processor is idle, it runs there else, may look at next thread, to run on its ideal processor else, may look at next thread, to run on its ideal processor

Multiprocessor Support (2) Hard affinity Hard affinity –Restricts thread to a subset of the available CPUs –Can lead to: threads getting less CPU time that they normally would threads getting less CPU time that they normally would Other scheduling anomalies Other scheduling anomalies –Only rarely appropriate

Hard Affinity Example (1) Single processor, fully loaded

Hard Affinity Example (2) Set affinity menu

Hard Affinity Example (3) Affinity setting

Hard Affinity Example (4) Hard affinity – one CPU loaded

Hard Affinity Example (5) Affinity effects

Hard Affinity Example (6) Adding CPU time using Perfmon

Hard Affinity Example (7) Perfmon affinity effects