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.

Slides:



Advertisements
Similar presentations
Uniprocessor Scheduling Chapter 9 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Advertisements

CPU Scheduling Tanenbaum Ch 2.4 Silberchatz and Galvin Ch 5.
CSC 322 Operating Systems Concepts Lecture - 11: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Operating Systems Process Scheduling (Ch 3.2, )
IT Systems Multiprocessor System EN230-1 Justin Champion C208 –
 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.
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.
Chapter 2: Processes Topics –Processes –Threads –Process Scheduling –Inter Process Communication (IPC) Reference: Operating Systems Design and Implementation.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
Cs238 CPU Scheduling Dr. Alan R. Davis. CPU Scheduling The objective of multiprogramming is to have some process running at all times, to maximize CPU.
Chapter 11 Operating Systems
Job scheduling Queue discipline.
Operating Systems Process Scheduling (Ch 4.2, )
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
Operating System Process Scheduling (Ch 4.2, )
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
CPU Scheduling - Multicore. Reading Silberschatz et al: Chapter 5.5.
CSC 360- Instructor: K. Wu CPU Scheduling. CSC 360- Instructor: K. Wu Agenda 1.What is CPU scheduling? 2.CPU burst distribution 3.CPU scheduler and dispatcher.
Windows 2000 Scheduling Computing Department, Lancaster University, UK.
Windows OS Internals - Copyright © 2005 David A. Solomon, Mark E. Russinovich, and Andreas Polze Unit OS4: Scheduling and Dispatch 4.4. Windows Thread.
Chapter 6 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.
Chapter 5 – CPU Scheduling (Pgs 183 – 218). CPU Scheduling  Goal: To get as much done as possible  How: By never letting the CPU sit "idle" and not.
CS 153 Design of Operating Systems Spring 2015 Lecture 11: Scheduling & Deadlock.
Chapter 6 Scheduling. Basic concepts Goal is maximum utilization –what does this mean? –cpu pegged at 100% ?? Most programs are I/O bound Thus some other.
1 CSE451 Scheduling Autumn 2002 Gary Kimura Lecture #6 October 11, 2002.
CE Operating Systems Lecture 11 Windows – Object manager and process management.
1 Scheduling The part of the OS that makes the choice of which process to run next is called the scheduler and the algorithm it uses is called the scheduling.
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 – 7 th Edition, Feb 2, 2005 Chapter 5: CPU Scheduling Basic.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
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.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
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.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
CPU Scheduling CS Introduction to Operating Systems.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
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.
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
lecture 5: CPU Scheduling
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Chapter 5a: CPU Scheduling
Uniprocessor Scheduling
April 6, 2001 Gary Kimura Lecture #6 April 6, 2001
Uniprocessor Scheduling
Chapter 2 Scheduling.
Uniprocessor Scheduling
A Comparison Study of Process Scheduling in FreeBSD, Linux and Win2k
Chapter 6: CPU Scheduling
Chapter 2: The Linux System Part 3
TDC 311 Process Scheduling.
Scheduling.
Chapter 5: CPU Scheduling
Process scheduling Chapter 5.
Chapter 9 Uniprocessor Scheduling
Chapter 6: CPU Scheduling
Process Scheduling Decide which process should run and for how long
Uniprocessor scheduling
Uniprocessor Scheduling
Presentation transcript:

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 Windows NT Scheduler, Part 2 Multiprocessor scheduling decisions can affect NT’s scalability by Mark Russinovich Windows NT Magazine - August 1997 Presented by: Jack McCrorey

2 Main Topics Windows NT Scheduler on Uniprocessor system Windows NT Scheduler on Multiprocessor systems Options, Tradeoffs, and techniques Unusual Consequences Final thoughts

3 Windows NT Scheduling Basic scheduling unit is a Thread A thread is an executable entity that runs in the address space of a process Priority based scheduling Preemptive operating system No shortest job first, no quotas

4 Priority Levels Priorities are assigned to Threads Priorities are from 0 to 31 –31 is the highest; 0 is system idle thread –Realtime priorities: –Dynamic priorities:

5 Priority Assignment NT kernel uses 31 priority levels Users specify a priority class: –realtime (24), high (13), normal (8) and idle (4) –and a relative priority: –highest (+2), above normal (+1), normal (0), below normal (-1), and lowest (-2) –to establish the Starting priority Threads also have a current priority

6 Priorities

7 Quantum Determines how long a Thread runs once selected Varies based on: NT Workstation or NT Server Intel or Alpha hardware Foreground/Background application threads –NOTE: NT 4.0 increases quantum for foreground threads while NT 3.5 increased priorities

8 Thread States WaitingRunningReady New Dispatch Interrupt I/O Wait I/O Complete Exit Slide “borrowed” from CS502 Class Slides - Mark Claypool

9 Scheduling Decision 1A running thread’s quantum expires 2A running thread waits for an event to occur 3A thread becomes ready to execute FindReadyThread ReadyThread

10 Dispatcher Ready List Keeps track of all Ready-to-execute threads 31 entries for each priority level queue of threads assigned to each level Dispatcher Ready List Ready Threads

11 FindReadyThread Locates the highest priority thread that is ready to execute Scans dispatcher ready list Picks front thread in highest priority nonempty queue –How is this different from SelectProcessToRun (last weeks code sample)? How is it the same?

12 ReadyThread Places threads in Dispatcher Ready List If (ready-thread-priority > executing-thread-priority) Preempt executing-thread Put executing-thread back in DRL at front of queue (this thread has some remaining quantum to run) Else Put ready-thread in DRL at back of queue

13 Boosting and Decay Priority of Dynamic range threads are boosted in some situations –Usually when an event happens that a blocked thread is waiting on –Realtime priorities are not boosted –Boosts never exceed priority 15 Boost decreases by one for each quantum Decays to starting priority (no lower)

14 Starvation Prevention Low priority threads may never execute NT has an “anti-CPU starvation policy” for threads that have not executed for 3 seconds –boosts priority to 15 –doubles quantum –calls ReadyThread Decay is swift not gradual after this boost

15 Multiprocessor Systems Scheduler can choose among several CPUs NT supports symmetric multiprocessing OS kernel can run on any CPU –Simultaneously on several CPUs!! CPUs have own cache Equal access to main memory and I/O

16 SMP

17 Protecting Data NT kernel protects shared data structures with locks The DRL is a core data structure that NT protects with a lock If lock is not available, the CPU waits Scheduler will never run simultaneously

18 SMP Scheduling Situations requiring scheduling are the same One new Ready-to-execute situation –One CPU pulls thread off before quantum is exhausted –Thread is still eligible to execute (on another CPU) –Call ReadyThread

19 Affinity and Ideal Processor Soft Affinity - Scheduler tries to run thread on CPU it last executed on Hard Affinity - thread is assigned a list of CPUs that in can run on Ideal Processor - every thread is assigned an ideal CPU Scheduler tries to run thread on Ideal CPU Preferred choice from Hard affinity list

20 FindReadyThread -SMP Acquire DRL Lock Find highest priority non-empty queue Mark first thread with Hard Affinity = CPU as Primary candidate If Primary-Soft-affinity = CPU OR Ideal-Processor = CPU OR Time-since-last-execute > 20 ms Choose Primary as next thread to execute Else Look down queue for 1st thread that satisfies above If new-thread is found Choose it Else Choose Primary Release DRL Lock

21 Skipping a thread

22 ReadyThread - SMP Acquire DRL lock If Idle-CPU = ready-thread-Hard-Affinity-List signal Idle-CPU to execute thread Else Examine executing-thread-priority on ready-thread-IdealCPU If ready-thread-priority > execute-thread-priority signal CPU to stop current and execute this thread Else place ready-thread on DRL Release DRL lock

23 High priority thread must wait

24 Thread Migration

25 Alternative Approach Soft - AffinityPriority Based

26 Final Thoughts Microsoft claims high SQL Srv. throughput Author claims NT scheduling tuned for this Theoretical problem shown No measurements, proofs, scenarios What is a “good” scheduler? –Fair, Efficient, Responsive, Turnaround Time, and Throughput