CS 4284 Systems Capstone. Resource Allocation & Scheduling Godmar Back
|
|
- Shannon Dean
- 6 years ago
- Views:
Transcription
1 CS 4284 Systems Capstone Resource Allocation & Scheduling Godmar Back
2 Resource Allocation and Scheduling
3 Resource Allocation & Scheduling Resource management is primary OS function Involves resource allocation & scheduling Who gets to use what resource and for how long Example resources: CPU time Disk bandwidth Network bandwidth RAM Disk space Processes are the principals that use resources often on behalf of users
4 Preemptible vs Nonpreemptible Resources Nonpreemptible resources: Once allocated, can t easily ask for them back must wait until process returns them (or exits) Examples: Locks, Disk Space, Control of terminal Preemptible resources: Can be taken away ( preempted ) and returned without the process noticing it Examples: CPU, Memory
5 Physical vs Virtual Memory Classification of a resource as preemptible depends on price one is willing to pay to preempt it Can theoretically preempt most resources via copying & indirection Virtual Memory: mechanism to make physical memory preemptible Take away by swapping to disk, return by reading from disk (possibly swapping out others) Not always tolerable resident portions of kernel Pintos kernel stack pages
6 Space Sharing vs Time Sharing Space Sharing: Allocation ( how much? ) Use if resource can be split (multiple CPUs, memory, etc.) Use if resource is non-preemptible Time Sharing: Scheduling ( how long? ) Use if resource can t be split Use if resource is easily preemptible
7 CPU vs. Other Resources CPU is not the only resource that needs to be scheduled Overall system performance depends on efficient use of all resources Resource can be in use (busy) or be unused (idle) Duty cycle: portion of time busy Consider I/O device: busy after receiving I/O request if CPU scheduler delays process that will issue I/O request, I/O device is underutilized Ideal: want to keep all devices busy
8 Per-process perspective Process alternates between CPU bursts & I/O bursts I/O Bound Process CPU Bound Process CPU I/O
9 Global perspective If these were executed on the same CPU: I/O Bound Process CPU Bound Process Waiting CPU I/O
10 CPU Scheduling Part I
11 CPU Scheduling Terminology A job (sometimes called a task, or a job instance) Activity that s scheduled: process or part of a process Arrival time: time when job arrives Start time: time when job actually starts Finish time: time when job is done Completion time (aka Turn-around time) Finish time Arrival time Response time Time when user sees response Arrival time Execution time (aka cost): time a job needs to execute Arrival Time Start Time Finish Time waiting CPU burst I/O waiting CPU Response Time Completion Time
12 CPU Scheduling Terminology (2) Waiting time = time when job was readyto-run didn t run because CPU scheduler picked another job Blocked time = time when job was blocked while I/O device is in use Completion time Execution time + Waiting time + Blocked time
13 Static vs Dynamic Scheduling Static All jobs, their arrival & execution times are known in advance, create a schedule, execute it Used in statically configured systems, such as embedded real-time systems Dynamic or Online Scheduling Jobs are not known in advance, scheduler must make online decision whenever jobs arrives or leaves Execution time may or may not be known Behavior can be modeled by making assumptions about nature of arrival process
14 Scheduling Algorithms vs Scheduler Implementations Scheduling algorithms properties are (usually) analyzed under static assumptions first; then adapted for dynamic scenarios Algorithms often consider only an abstract notion of (CPU) jobs, but a dynamic scheduler must map that to processes with alternating - and repeating - CPU and IO bursts Often applies static algorithm to current ready queue Algorithms often assume length of job/cpu burst is known, but real scheduler must estimate expected execution cost (or make assumptions)
15 Preemptive vs Nonpreemptive Q.: when is scheduler asked to pick a thread from ready queue? Nonpreemptive: Only when RUNNING BLOCKED transition Or RUNNING EXIT Or voluntary yield: RUNNING READY Preemptive Also when BLOCKED READY transition Also on timer (forced call to yield upon intr exit) Scheduling Process must wait for event BLOCKED RUNNING Event arrived Process preempted READY Scheduler picks process
16 CPU Scheduling Goals Minimize latency Can mean (avg) completion time Can mean (avg) response time Maximize throughput Throughput: number of finished jobs per time-unit Implies minimizing overhead (for context-switching, for scheduling algorithm itself) Requires efficient use of non-cpu resources Fairness Minimize variance in waiting time/completion time
17 Scheduling Constraints Reaching those goals is difficult, because Goals are conflicting: Latency vs. throughput Fairness vs. low overhead Scheduler must operate with incomplete knowledge Execution time may not be known I/O device use may not be known Scheduler must make decision fast Approximate best solution from huge solution space
18 First Come First Serve Schedule processes in the order in which they arrive Run until completion (or until they block) Simple! Example: Q.: what is the average completion time?
19 FCFS (cont d) Disadvantage: completion time depends on arrival order Unfair to short jobs Possible Convoy Effect: 1 CPU bound (long CPU bursts, infrequent I/O bursts), multiple I/O bound jobs (frequent I/O bursts, short CPU bursts). CPU bound process monopolizes CPU: I/O devices are idle New I/O requests by I/O bound jobs are only issued when CPU bound job blocks CPU bound job leads convoy of I/O bound processes FCFS not usually used for CPU scheduling, but often used for other resources (network device)
20 Round-Robin Run process for a timeslice (quantum), then move on to next process, repeat Decreases avg completion if jobs are of different lengths No more unfairness to short jobs! Q.: what is the average completion time?
21 Round Robin (2) What if there are no short jobs? Q.: what is the average completion time? What would it be under FCFS?
22 Round Robin Cost of Time Slicing Context switching incurs a cost Direct cost (execute scheduler & context switch) + indirect cost (cache & TLB misses) Long time slices lower overhead, but approaches FCFS if processes finish before timeslice expires Short time slices lots of context switches, high overhead Typical cost: context switch < 10µs Time slice typically around 100ms Note: time slice length!= interval between timer interrupts where periodic timers are used
23 Shortest Process Next (SPN) Idea: remove unfairness towards short processes by always picking the shortest job If done nonpreemptively also known as: Shortest Job First (SJF), Shortest Time to Completion First (STCF) If done preemptively known as: Shortest Remaining Time (SRT), Shortest Remaining Time to Completion First (SRTCF)
24 SPN (cont d) Provably optimal with respect to avg waiting time: Moving shorter job up reduces its waiting time more than it delays waiting time of longer job that follows Advantage: Good I/O utilization Disadvantage: Can starve long jobs Big Q: How do we know the length of a job?
25 Practical SPN Usually don t know (remaining) execution time Exception: profiled code in real-time system; or worstcase execution time analysis (WCET) Idea: determine future from past: Assume next CPU burst will be as long as previous CPU burst Or: weigh history using (potentially exponential) average: more recent burst lengths more predictive than past CPU bursts Note: for some resources, we know or can compute length of next job : Example: disk scheduling (shortest-seek time first)
26 Aside computation-takes-time-but-howmuch/fulltext Computation Takes Time, But How Much? Reinhard Wilhelm, Daniel Grund Communications of the ACM, Vol. 57 No. 2, Pages /
27 Multi-Level Feedback Queue Scheduling Kleinrock 1969 Want: preference for short jobs (tends to lead to good I/O utilization) longer timeslices for CPU bound jobs (reduces context-switching overhead) Problem: Don t know type of each process algorithm needs to figure out Use multiple queues queue determines priority usually combined with static priorities (nice values) many variations of this idea exist
28 Longer Timeslices Higher Priority MAX MLFQS Processes start in highest queue Process that use up their time slice move down MIN 1 Higher priority queues are served before lower-priority ones - within highest-priority queue, round-robin Only ready processes are in this queue - blocked processes leave queue and reenter same queue on unblock Processes that starve move up
29 Basic Scheduling: Summary FCFS: simple unfair to short jobs & poor I/O performance (convoy effect) RR: helps short jobs loses when jobs are equal length SPN: optimal average waiting time which, if ignoring blocking time, leads to optimal average completion time unfair to long jobs requires knowing (or guessing) the future MLFQS: approximates SPN without knowing execution time Can still be unfair to long jobs
30 CPU Scheduling Part II
31 Case Study: 2.6 Linux Scheduler Variant of MLFQS 140 priorities 0-99 realtime nonrealtime Dynamic priority computed from static priority (nice) plus interactivity bonus (pre ) Processes scheduled based on dynamic priority SCHED_OTHER Realtime processes scheduled based on static priority SCHED_FIFO SCHED_RR nice=19 nice=0 nice=-20
32 Linux Scheduler (2) Instead of recomputation loop, recompute priority at end of each timeslice dyn_prio = nice + interactivity bonus (-5 5) Interactivity bonus depends on sleep_avg measures time a process was blocked 2 priority arrays ( active & expired ) in each runqueue (Linux calls ready queues runqueue )
33 Linux Scheduler (3) struct prio_array { unsigned int nr_active; unsigned long bitmap[bitmap_size]; struct list_head queue[max_prio]; }; typedef struct prio_array prio_array_t; /* find the highest-priority ready thread */ idx = sched_find_first_bit(array->bitmap); queue = array->queue + idx; next = list_entry(queue->next, task_t, run_list); /* Per CPU runqueue */ struct runqueue { prio_array_t *active; prio_array_t *expired; prio_array_t arrays[2]; } Finds highest-priority ready thread quickly Switching active & expired arrays at end of epoch is simple pointer swap ( O(1) claim)
34 Linux Timeslice Computation Linux scales static priority to timeslice Nice [ ] maps to [800ms 100 ms 5ms] Various tweaks: interactive processes are reinserted into active array even after timeslice expires Unless processes in expired array are starving processes with long timeslices are roundrobin d with other of equal priority at subtimeslice granularity
35 History Variants of MLFQS dominant until a few years ago; still used in Windows kernel Accompanied by belief that online scheduler must be O(1) with small c MLFQS are easily manipulated and do not guarantee fair ( proportional ) CPU assignments Another problem is accuracy of accounting sampling charges entire tick to process that happened to be running at that point
36 Accuracy of accounting Instead of relying on sampling, modern versions of OS use cycle counters or highprecision timers to accurate determine a process s recent CPU usage. This also makes it easy to exclude time spent in IRQ handling that should not be charged to a process See [Inside the Vista Kernel] for a graph
37 Linux s CFS Linux went a step further and reinvented WFQ (of course without any credit), implemented in its CFS completely fair scheduler O (log n) red/black tree But does not aim to support really large n But, as we ll see, WFQ does not automatically give precedence to I/O bound apps; required a lot of Interactivity improvements to tune it heuristically Well-known trade-off between fairness & latency
38 Proportional Share Scheduling Aka Fair-Share Scheduling None of algorithms discussed so far provide a direct way of assigning CPU shares E.g., give 30% of CPU to process A, 70% to process B Proportional Share algorithms do by assigning tickets or shares to processes Process get to use resource in proportion of their shares to total number of shares Lottery Scheduling, Weighted Fair Queuing/Stride Scheduling [Waldspurger 1995]
39 Lottery Scheduling Idea: number tickets between 1 N every process gets p i tickets according to importance process 1 gets tickets [1 p 1-1] process 2 gets tickets [p 1 p 1+ p 2-1] and so on. Scheduling decision: Hold a lottery and draw ticket, holder gets to run for next time slice Nondeterministic algorithm Q.: how to implement priority donation?
40 Weighted Fair Queuing Uses per process virtual time Increments process s virtual time by a stride after each quantum, which is defined as (process_share) -1 Choose process with lowest virtual finishing time virtual finishing time is virtual time + stride Also known as stride scheduling Linux now implements a variant of WFQ/Stride Scheduling as its CFS completely fair scheduler
41 WFQ Example (A=3, B=2, C=1) Ready Queue is sorted by Virtual Finish Time (Virtual Time at end of quantum if a process were scheduled) Time Task A Task B Task C Ready Queue Who Runs 0 1/3 1/2 1 A (1/3) B (1/2) C (1) A 1 2/3 1/2 1 B (1/2) A (2/3) C (1) B 2 2/3 1 1 A (2/3) C(1) B(1) A C(1) B(1) A(1) C B(1) A(1) C(2) B 5 1 3/2 2 A(1) B(3/2) C(2) A 6 4/3 3/2 2 A (4/3) B(3/2) C(2) One scheduling epoch. A ran 3 out of 6 quanta, B 2 out of 6, C 1 out of 6. This process will repeat, yielding proportional fairness.
42 WFQ (cont d) WFQ requires a sorted ready queue Linux now uses R/B tree Higher complexity than O(1) linked lists, but appears manageable for real-world ready queue sizes Unblocked processes that reenter the ready queue are assigned a virtual time reflecting the value that their virtual time counter would have if they d received CPU time proportionally Accommodating I/O bound processes still requires fudging In strict WFQ, only way to improve latency is to set number of shares high but this is disastrous if process is not truly I/O bound Linux uses sleeper fairness, to identify when to boost virtual time; similar to the sleep average in old scheduler
43 Linux SMP Load Balancing Runqueue is per CPU Periodically, lengths of runqueues on different CPU is compared Processes are migrated to balance load Aside: Migrating requires locks on both runqueues static void double_rq_lock( runqueue_t *rq1, runqueue_t *rq2) { if (rq1 == rq2) { spin_lock(&rq1->lock); } else { if (rq1 < rq2) { spin_lock(&rq1->lock); spin_lock(&rq2->lock); } else { spin_lock(&rq2->lock); spin_lock(&rq1->lock); } } }
44 Real-time Scheduling Real-time systems must observe not only execution time, but a deadline as well Jobs must finish by deadline But turn-around time is usually less important Common scenario are recurring jobs E.g., need 3 ms every 10 ms (here, 10ms is the recurrence period T, 3 ms is the cost C) Possible strategies RMA (Rate Monotonic) Map periods to priorities, fixed, static EDF (Earliest Deadline First) Always run what s due next, dynamic
45 EDF Example Task T C A 4 1 B 8 4 C 12 3 Assume deadline equals period (T). A B C Hyper-period
46 EDF Example Task T C A 4 1 B 8 4 C 12 3 Assume deadline equals period (T). A B C
47 EDF Example Task T C A 4 1 B 8 4 C 12 3 Assume deadline equals period (T). A B C
48 EDF Example Lexical order tie breaker (C > B > A) Task T C A 4 1 B 8 4 C 12 3 Assume deadline equals period (T). A B C
49 EDF Example Task T C A 4 1 B 8 4 C 12 3 Assume deadline equals period (T). A B C
50 EDF Example Task T C A 4 1 B 8 4 C 12 3 Assume deadline equals period (T). A B C
51 EDF Example Task T C A 4 1 B 8 4 C 12 3 Assume deadline equals period (T). A B C
52 EDF Example Task T C A 4 1 B 8 4 C 12 3 Assume deadline equals period (T). A B C
53 EDF Example Task T C A 4 1 B 8 4 C 12 3 Assume deadline equals period (T). A B C Pattern repeats
54 EDF Properties Feasibility test: U = 100% in example Bound theoretical Sufficient and necessary Optimal
55 Scheduling Summary OS must schedule all resources in a system CPU, Disk, Network, etc. CPU Scheduling affects indirectly scheduling of other devices Goals for general purpose schedulers: Minimizing latency (avg. completion or waiting time) Maximing throughput Provide fairness In Practice: some theory, lots of tweaking
ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads
ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective Part I: Operating system overview: Processes and threads 1 Overview Process concept Process scheduling Thread
More informationLast Class: Processes
Last Class: Processes A process is the unit of execution. Processes are represented as Process Control Blocks in the OS PCBs contain process state, scheduling and memory management information, etc A process
More informationOperating Systems. Scheduling
Operating Systems Scheduling Process States Blocking operation Running Exit Terminated (initiate I/O, down on semaphore, etc.) Waiting Preempted Picked by scheduler Event arrived (I/O complete, semaphore
More informationHigh level scheduling: Medium level scheduling: Low level scheduling. Scheduling 0 : Levels
Scheduling 0 : Levels High level scheduling: Deciding whether another process can run is process table full? user process limit reached? load to swap space or memory? Medium level scheduling: Balancing
More informationLecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter
Lecture Topics Today: Uniprocessor Scheduling (Stallings, chapter 9.1-9.3) Next: Advanced Scheduling (Stallings, chapter 10.1-10.4) 1 Announcements Self-Study Exercise #10 Project #8 (due 11/16) Project
More information238P: Operating Systems. Lecture 14: Process scheduling
238P: Operating Systems Lecture 14: Process scheduling This lecture is heavily based on the material developed by Don Porter Anton Burtsev November, 2017 Cooperative vs preemptive What is cooperative multitasking?
More informationCS 326: Operating Systems. CPU Scheduling. Lecture 6
CS 326: Operating Systems CPU Scheduling Lecture 6 Today s Schedule Agenda? Context Switches and Interrupts Basic Scheduling Algorithms Scheduling with I/O Symmetric multiprocessing 2/7/18 CS 326: Operating
More informationAnnouncements. Program #1. Program #0. Reading. Is due at 9:00 AM on Thursday. Re-grade requests are due by Monday at 11:59:59 PM.
Program #1 Announcements Is due at 9:00 AM on Thursday Program #0 Re-grade requests are due by Monday at 11:59:59 PM Reading Chapter 6 1 CPU Scheduling Manage CPU to achieve several objectives: maximize
More informationCSL373: Lecture 6 CPU Scheduling
CSL373: Lecture 6 CPU Scheduling First come first served (FCFS or FIFO) Simplest scheduling algorithm cpu cpu 0 0 Run jobs in order that they arrive Disadvantage: wait time depends on arrival order. Unfair
More informationPractice Exercises 305
Practice Exercises 305 The FCFS algorithm is nonpreemptive; the RR algorithm is preemptive. The SJF and priority algorithms may be either preemptive or nonpreemptive. Multilevel queue algorithms allow
More information8: Scheduling. Scheduling. Mark Handley
8: Scheduling Mark Handley Scheduling On a multiprocessing system, more than one process may be available to run. The task of deciding which process to run next is called scheduling, and is performed by
More informationCS Computer Systems. Lecture 6: Process Scheduling
CS 5600 Computer Systems Lecture 6: Process Scheduling Scheduling Basics Simple Schedulers Priority Schedulers Fair Share Schedulers Multi-CPU Scheduling Case Study: The Linux Kernel 2 Setting the Stage
More informationCPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)
CPU Scheduling Daniel Mosse (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013) Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU I/O Burst Cycle Process
More informationOperating Systems. Process scheduling. Thomas Ropars.
1 Operating Systems Process scheduling Thomas Ropars thomas.ropars@univ-grenoble-alpes.fr 2018 References The content of these lectures is inspired by: The lecture notes of Renaud Lachaize. The lecture
More informationò mm_struct represents an address space in kernel ò task represents a thread in the kernel ò A task points to 0 or 1 mm_structs
Last time We went through the high-level theory of scheduling algorithms Scheduling Today: View into how Linux makes its scheduling decisions Don Porter CSE 306 Lecture goals Understand low-level building
More informationScheduling. Don Porter CSE 306
Scheduling Don Porter CSE 306 Last time ò We went through the high-level theory of scheduling algorithms ò Today: View into how Linux makes its scheduling decisions Lecture goals ò Understand low-level
More informationOPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5
OPERATING SYSTEMS CS3502 Spring 2018 Processor Scheduling Chapter 5 Goals of Processor Scheduling Scheduling is the sharing of the CPU among the processes in the ready queue The critical activities are:
More informationW4118: advanced scheduling
W4118: advanced scheduling Instructor: Junfeng Yang References: Modern Operating Systems (3 rd edition), Operating Systems Concepts (8 th edition), previous W4118, and OS at MIT, Stanford, and UWisc Outline
More informationScheduling: Case Studies. CS 161: Lecture 5 2/14/17
Scheduling: Case Studies CS 161: Lecture 5 2/14/17 Scheduling Basics Goal of scheduling: Pick the best task to run on a CPU Often a good idea to prioritize IO-bound tasks If IO comes from user (e.g., keyboard,
More informationContext Switching & CPU Scheduling
Context Switching & CPU Scheduling Nima Honarmand Administrivia Midterm: next Tuesday, 10/17, in class Will include everything discussed until then Will cover: Class lectures, slides and discussions All
More informationSubject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date:
Subject Name: OPERATING SYSTEMS Subject Code: 10EC65 Prepared By: Kala H S and Remya R Department: ECE Date: Unit 7 SCHEDULING TOPICS TO BE COVERED Preliminaries Non-preemptive scheduling policies Preemptive
More informationCPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )
CPU Scheduling CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections 6.7.2 6.8) 1 Contents Why Scheduling? Basic Concepts of Scheduling Scheduling Criteria A Basic Scheduling
More informationCSCI-GA Operating Systems Lecture 3: Processes and Threads -Part 2 Scheduling Hubertus Franke
CSCI-GA.2250-001 Operating Systems Lecture 3: Processes and Threads -Part 2 Scheduling Hubertus Franke frankeh@cs.nyu.edu Processes Vs Threads The unit of dispatching is referred to as a thread or lightweight
More informationProcess Scheduling. Copyright : University of Illinois CS 241 Staff
Process Scheduling Copyright : University of Illinois CS 241 Staff 1 Process Scheduling Deciding which process/thread should occupy the resource (CPU, disk, etc) CPU I want to play Whose turn is it? Process
More informationCS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University
Frequently asked questions from the previous class survey CS 370: SYSTEM ARCHITECTURE & SOFTWARE [CPU SCHEDULING] Shrideep Pallickara Computer Science Colorado State University OpenMP compiler directives
More informationOperating Systems. Lecture Process Scheduling. Golestan University. Hossein Momeni
Operating Systems Lecture 2.2 - Process Scheduling Golestan University Hossein Momeni momeni@iust.ac.ir Scheduling What is scheduling? Goals Mechanisms Scheduling on batch systems Scheduling on interactive
More informationCS3733: Operating Systems
CS3733: Operating Systems Topics: Process (CPU) Scheduling (SGG 5.1-5.3, 6.7 and web notes) Instructor: Dr. Dakai Zhu 1 Updates and Q&A Homework-02: late submission allowed until Friday!! Submit on Blackboard
More informationChapter 6: CPU Scheduling. Operating System Concepts 9 th Edition
Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne 2013 Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time
More informationProcesses. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005
INF060: Introduction to Operating Systems and Data Communication Operating Systems: Processes & CPU Pål Halvorsen /9-005 Overview Processes primitives for creation and termination states context switches
More informationCPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)
1/32 CPU Scheduling The scheduling problem: - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s) When do we make decision? 2/32 CPU Scheduling Scheduling decisions may take
More informationPROCESS SCHEDULING II. CS124 Operating Systems Fall , Lecture 13
PROCESS SCHEDULING II CS124 Operating Systems Fall 2017-2018, Lecture 13 2 Real-Time Systems Increasingly common to have systems with real-time scheduling requirements Real-time systems are driven by specific
More informationComputer Systems Laboratory Sungkyunkwan University
CPU Scheduling Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics General scheduling concepts Scheduling algorithms Case studies Linux
More informationCPU Scheduling. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University
Operating Systems (Fall/Winter 2018) CPU Scheduling Yajin Zhou (http://yajin.org) Zhejiang University Acknowledgement: some pages are based on the slides from Zhi Wang(fsu). Review Motivation to use threads
More informationScheduling in the Supermarket
Scheduling in the Supermarket Consider a line of people waiting in front of the checkout in the grocery store. In what order should the cashier process their purchases? Scheduling Criteria CPU utilization
More informationChapter 6: CPU Scheduling. Operating System Concepts 9 th Edition
Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne 2013 Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time
More informationCourse Syllabus. Operating Systems
Course Syllabus. Introduction - History; Views; Concepts; Structure 2. Process Management - Processes; State + Resources; Threads; Unix implementation of Processes 3. Scheduling Paradigms; Unix; Modeling
More informationChapter 5: CPU Scheduling
Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm Evaluation Chapter 5: CPU Scheduling
More informationCS 318 Principles of Operating Systems
CS 318 Principles of Operating Systems Fall 2018 Lecture 4: Scheduling Ryan Huang Slides adapted from David Mazières lectures Administrivia Lab 0 Due today Submit in Blackboard Lab 1 released Due in two
More informationChap 7, 8: Scheduling. Dongkun Shin, SKKU
Chap 7, 8: Scheduling 1 Introduction Multiprogramming Multiple processes in the system with one or more processors Increases processor utilization by organizing processes so that the processor always has
More informationCOSC243 Part 2: Operating Systems
COSC243 Part 2: Operating Systems Lecture 17: CPU Scheduling Zhiyi Huang Dept. of Computer Science, University of Otago Zhiyi Huang (Otago) COSC243 Lecture 17 1 / 30 Overview Last lecture: Cooperating
More informationFrequently asked questions from the previous class survey
CS 370: OPERATING SYSTEMS [CPU SCHEDULING] Shrideep Pallickara Computer Science Colorado State University L14.1 Frequently asked questions from the previous class survey Turnstiles: Queue for threads blocked
More informationINF1060: Introduction to Operating Systems and Data Communication. Pål Halvorsen. Wednesday, September 29, 2010
INF1060: Introduction to Operating Systems and Data Communication Pål Halvorsen Wednesday, September 29, 2010 Overview Processes primitives for creation and termination states context switches processes
More informationScheduling of processes
Scheduling of processes Processor scheduling Schedule processes on the processor to meet system objectives System objectives: Assigned processes to be executed by the processor Response time Throughput
More informationIntroduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras
Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Week 05 Lecture 18 CPU Scheduling Hello. In this lecture, we
More informationCPU Scheduling. Basic Concepts. Histogram of CPU-burst Times. Dispatcher. CPU Scheduler. Alternating Sequence of CPU and I/O Bursts
CS307 Basic Concepts Maximize CPU utilization obtained with multiprogramming CPU Scheduling CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait CPU burst distribution
More informationOperating Systems. CPU Scheduling ENCE 360
Operating Systems CPU Scheduling ENCE 360 Operating System Schedulers Short-Term Which Ready process to Running? CPU Scheduler Long-Term (batch) Which requested process into Ready Queue? Admission scheduler
More informationProcess management. Scheduling
Process management Scheduling Points of scheduler invocation (recap) User Kernel Return from system call Process Schedule Return from interrupt handler Timer interrupts to ensure OS control Return from
More informationCPU Scheduling (1) CPU Scheduling (Topic 3) CPU Scheduling (2) CPU Scheduling (3) Resources fall into two classes:
CPU Scheduling (Topic 3) 홍성수 서울대학교공과대학전기공학부 Real-Time Operating Systems Laboratory CPU Scheduling (1) Resources fall into two classes: Preemptible: Can take resource away, use it for something else, then
More informationLECTURE 3:CPU SCHEDULING
LECTURE 3:CPU SCHEDULING 1 Outline Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time CPU Scheduling Operating Systems Examples Algorithm Evaluation 2 Objectives
More informationPROCESS SCHEDULING Operating Systems Design Euiseong Seo
PROCESS SCHEDULING 2017 Operating Systems Design Euiseong Seo (euiseong@skku.edu) Histogram of CPU Burst Cycles Alternating Sequence of CPU and IO Processor Scheduling Selects from among the processes
More informationChapter 5: CPU Scheduling. Operating System Concepts 8 th Edition,
Chapter 5: CPU Scheduling Operating System Concepts 8 th Edition, Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2009 Chapter 5: Process Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms
More informationAdvanced Operating Systems (CS 202) Scheduling (1)
Advanced Operating Systems (CS 202) Scheduling (1) Today: CPU Scheduling 2 The Process The process is the OS abstraction for execution It is the unit of execution It is the unit of scheduling It is the
More informationScheduling. Today. Next Time Process interaction & communication
Scheduling Today Introduction to scheduling Classical algorithms Thread scheduling Evaluating scheduling OS example Next Time Process interaction & communication Scheduling Problem Several ready processes
More informationScheduling. CSC400 - Operating Systems. 7: Scheduling. J. Sumey. one of the main tasks of an OS. the scheduler / dispatcher
CSC400 - Operating Systems 7: Scheduling J. Sumey Scheduling one of the main tasks of an OS the scheduler / dispatcher concerned with deciding which runnable process/thread should get the CPU next occurs
More informationCPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)
CPU Scheduling The scheduling problem: - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s) When do we make decision? 1 / 31 CPU Scheduling new admitted interrupt exit terminated
More informationAnnouncements. Program #1. Reading. Due 2/15 at 5:00 pm. Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed)
Announcements Program #1 Due 2/15 at 5:00 pm Reading Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed) 1 Scheduling criteria Per processor, or system oriented CPU utilization
More informationRecap. Run to completion in order of arrival Pros: simple, low overhead, good for batch jobs Cons: short jobs can stuck behind the long ones
Recap First-Come, First-Served (FCFS) Run to completion in order of arrival Pros: simple, low overhead, good for batch jobs Cons: short jobs can stuck behind the long ones Round-Robin (RR) FCFS with preemption.
More informationChapter 9. Uniprocessor Scheduling
Operating System Chapter 9. Uniprocessor Scheduling Lynn Choi School of Electrical Engineering Scheduling Processor Scheduling Assign system resource (CPU time, IO device, etc.) to processes/threads to
More informationChapter 5: CPU Scheduling
COP 4610: Introduction to Operating Systems (Fall 2016) Chapter 5: CPU Scheduling Zhi Wang Florida State University Contents Basic concepts Scheduling criteria Scheduling algorithms Thread scheduling Multiple-processor
More informationCPU Scheduling. Schedulers. CPSC 313: Intro to Computer Systems. Intro to Scheduling. Schedulers in the OS
Schedulers in the OS Scheduling Structure of a Scheduler Scheduling = Selection + Dispatching Criteria for scheduling Scheduling Algorithms FIFO/FCFS SPF / SRTF Priority - Based Schedulers start long-term
More informationOperating Systems ECE344. Ding Yuan
Operating Systems ECE344 Ding Yuan Announcement & Reminder Midterm exam Will grade them this Friday Will post the solution online before next lecture Will briefly go over the common mistakes next Monday
More informationScheduling policy. Reference: ULK3e 7.1. Scheduling in Linux 1 / 20
Scheduling policy Reference: ULK3e 7.1. Goals fast process response time good throughput for background jobs avoidance of process starvation reconciliation of needs of low- and high-priority processes
More informationChapter 5: CPU Scheduling. Operating System Concepts 9 th Edit9on
Chapter 5: CPU Scheduling Operating System Concepts 9 th Edit9on Silberschatz, Galvin and Gagne 2013 Chapter 6: CPU Scheduling 1. Basic Concepts 2. Scheduling Criteria 3. Scheduling Algorithms 4. Thread
More informationALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far.
Midterm Exam Reviews ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far. Particular attentions on the following: System call, system kernel Thread/process, thread vs process
More informationChap 7, 8: Scheduling. Dongkun Shin, SKKU
Chap 7, 8: Scheduling 1 Introduction Multiprogramming Multiple processes in the system with one or more processors Increases processor utilization by organizing processes so that the processor always has
More informationChapter 5: Process Scheduling
Chapter 5: Process Scheduling Chapter 5: Process Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time CPU Scheduling Operating Systems
More informationProcesses. CS 475, Spring 2018 Concurrent & Distributed Systems
Processes CS 475, Spring 2018 Concurrent & Distributed Systems Review: Abstractions 2 Review: Concurrency & Parallelism 4 different things: T1 T2 T3 T4 Concurrency: (1 processor) Time T1 T2 T3 T4 T1 T1
More informationLast class: Today: CPU Scheduling. CPU Scheduling Algorithms and Systems
1 Last class: CPU Scheduling Today: CPU Scheduling Algorithms and Systems 2 Scheduling Algorithms First-come, First-serve (FCFS) Non-preemptive Does not account for waiting time (or much else) Convoy problem
More informationBut this will not be complete (no book covers 100%) So consider it a rough approximation Last lecture OSPP Sections 3.1 and 4.1
ADRIAN PERRIG & TORSTEN HOEFLER ( 252-0062-00 ) Networks and Operating Systems Chapter 3: Scheduling Source: slashdot, Feb. 2014 Administrivia I will try to indicate book chapters But this will not be
More informationLinux Scheduler. OS 323 (Spring 2013)
Linux Scheduler OS 323 (Spring 2013) Process states CPU scheduler Makes the computer more productive by switching the CPU among processes CPU scheduling may take place when a process: 1. Switches from
More informationUniprocessor Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Three level scheduling
Uniprocessor Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Three level scheduling 2 1 Types of Scheduling 3 Long- and Medium-Term Schedulers Long-term scheduler Determines which programs
More informationOPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems, 3rd edition. Uses content with permission from Assoc. Prof. Florin Fortis, PhD
OPERATING SYSTEMS #5 After A.S.Tanenbaum, Modern Operating Systems, 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD General information GENERAL INFORMATION Cooperating processes
More informationCSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling
CSE120 Principles of Operating Systems Prof Yuanyuan (YY) Zhou Scheduling Announcement l Homework 2 due on October 26th l Project 1 due on October 27th 2 Scheduling Overview l In discussing process management
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 10 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 Chapter 6: CPU Scheduling Basic Concepts
More informationChapter 5 CPU scheduling
Chapter 5 CPU scheduling Contents Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling
More informationò Paper reading assigned for next Tuesday ò Understand low-level building blocks of a scheduler User Kernel ò Understand competing policy goals
Housekeeping Paper reading assigned for next Tuesday Scheduling Don Porter CSE 506 Memory Management Logical Diagram Binary Memory Formats Allocators Threads Today s Lecture Switching System to CPU Calls
More informationAnnouncements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)
Announcements Reading Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) 1 Relationship between Kernel mod and User Mode User Process Kernel System Calls User Process
More informationCSE 120 Principles of Operating Systems Spring 2017
CSE 120 Principles of Operating Systems Spring 2017 Lecture 5: Scheduling Administrivia Homework #1 due tomorrow Homework #2 out tomorrow October 20, 2015 CSE 120 Lecture 8 Scheduling and Deadlock 2 Scheduling
More informationProperties of Processes
CPU Scheduling Properties of Processes CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait. CPU burst distribution: CPU Scheduler Selects from among the processes that
More informationScheduling. CS 161: Lecture 4 2/9/17
Scheduling CS 161: Lecture 4 2/9/17 Where does the first process come from? The Linux Boot Process Machine turned on; BIOS runs BIOS: Basic Input/Output System Stored in flash memory on motherboard Determines
More informationProcess- Concept &Process Scheduling OPERATING SYSTEMS
OPERATING SYSTEMS Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne PROCESS MANAGEMENT Current day computer systems allow multiple
More informationExample: CPU-bound process that would run for 100 quanta continuously 1, 2, 4, 8, 16, 32, 64 (only 37 required for last run) Needs only 7 swaps
Interactive Scheduling Algorithms Continued o Priority Scheduling Introduction Round-robin assumes all processes are equal often not the case Assign a priority to each process, and always choose the process
More informationReview. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling
Review Preview Mutual Exclusion Solutions with Busy Waiting Test and Set Lock Priority Inversion problem with busy waiting Mutual Exclusion with Sleep and Wakeup The Producer-Consumer Problem Race Condition
More informationChapter 5 Scheduling
Chapter 5 Scheduling Images from Silberschatz Pacific University 1 Life time of a single process CPU usage/io bursts What would an IO bound process look like? What would a CPU bound process look like?
More informationCPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)
CPU Scheduling The scheduling problem: - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s) When do we make decision? 1 / 39 CPU Scheduling new admitted interrupt exit terminated
More informationScheduling. Scheduling 1/51
Scheduling 1/51 Learning Objectives Scheduling To understand the role of a scheduler in an operating system To understand the scheduling mechanism To understand scheduling strategies such as non-preemptive
More informationChapter 6: CPU Scheduling
Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne 2013 Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time
More informationChapter 6: CPU Scheduling. Operating System Concepts 9 th Edition
Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne 2013 Objectives To introduce CPU scheduling, which is the basis for multiprogrammed operating systems To describe various CPU-scheduling algorithms
More informationMulti-Level Feedback Queues
CS 326: Operating Systems Multi-Level Feedback Queues Lecture 8 Today s Schedule Building an Ideal Scheduler Priority-Based Scheduling Multi-Level Queues Multi-Level Feedback Queues Scheduling Domains
More informationCPU Scheduling. Rab Nawaz Jadoon. Assistant Professor DCS. Pakistan. COMSATS, Lahore. Department of Computer Science
CPU Scheduling Rab Nawaz Jadoon DCS COMSATS Institute of Information Technology Assistant Professor COMSATS, Lahore Pakistan Operating System Concepts Objectives To introduce CPU scheduling, which is the
More informationScalable Linux Scheduling (Paper # 9)
Scalable Linux Scheduling (Paper # 9) Scalability: the ability to support large number of threads. 30% of the total CPU time is spent in the scheduler when the number of running threads is high. Linux
More informationProcess Scheduling Part 2
Operating Systems and Computer Networks Process Scheduling Part 2 pascal.klein@uni-due.de Alexander Maxeiner, M.Sc. Faculty of Engineering Agenda Process Management Time Sharing Synchronization of Processes
More informationSection 7: Scheduling and Fairness
March 1-2, 2018 Contents 1 Warmup 2 2 Vocabulary 2 3 Problems 3 3.1 Scheduling............................................. 3 3.2 Simple Priority Scheduler.................................... 4 3.2.1 Fairness..........................................
More informationInteractive Scheduling
Interactive Scheduling 1 Two Level Scheduling Interactive systems commonly employ two-level scheduling CPU scheduler and Memory Scheduler Memory scheduler was covered in VM We will focus on CPU scheduling
More informationTwo Level Scheduling. Interactive Scheduling. Our Earlier Example. Round Robin Scheduling. Round Robin Schedule. Round Robin Schedule
Two Level Scheduling Interactive Scheduling Interactive systems commonly employ two-level scheduling CPU scheduler and Memory Scheduler Memory scheduler was covered in VM We will focus on CPU scheduling
More informationChapter 6: CPU Scheduling
Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne Histogram of CPU-burst Times 6.2 Silberschatz, Galvin and Gagne Alternating Sequence of CPU And I/O Bursts 6.3 Silberschatz, Galvin and Gagne CPU
More informationScheduling, part 2. Don Porter CSE 506
Scheduling, part 2 Don Porter CSE 506 Logical Diagram Binary Memory Formats Allocators Threads Today s Lecture Switching System to CPU Calls RCU scheduling File System Networking Sync User Kernel Memory
More informationChapter 6: CPU Scheduling
Chapter 6: CPU Scheduling Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time CPU Scheduling Operating Systems Examples
More informationOperating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst
Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Multilevel Feedback Queues (MLFQ) Multilevel feedback queues use past behavior to predict the future and assign
More informationFrequently asked questions from the previous class survey
CS 370: OPERATING SYSTEMS [CPU SCHEDULING] Shrideep Pallickara Computer Science Colorado State University L15.1 Frequently asked questions from the previous class survey Could we record burst times in
More information