Administration. Matteo Corti RZ H
|
|
- Myra Richard
- 6 years ago
- Views:
Transcription
1 Administration Matteo Corti RZ H Today: IFW A36, 16:15 D-INFK Colloquium Automated, compositional and iterative deadlock detection Natasha Sharygina, Carnegie Mellon University Exam: (tentative) hours 2 pages handwritten P. Reali / M. Corti
2 Activities Program (static concept) Process (dynamic) Processes, jobs, tasks, threads (differences later) program code context: program counter (PC) and registers stack pointer state [new] running waiting ready [terminated] stack data section (heap) 174 P. Reali / M. Corti
3 Processes vs. Threads Process or job (heavyweight) code address space processor state private data (stack+registers) Thread (lightweight) shared code shared address space processor state private data (stack+registers) can have multiple threads Kernel CPU 175 P. Reali / M. Corti
4 Processes vs. Threads: Example HEAP 1 HEAP 2 HEAP STACK 1 STACK 2 STACK 1 STACK 2 PROC 1 instr instr instr PROC 2 instr instr instr PROC instr instr instr 176 P. Reali / M. Corti
5 Multitasking synchronous asynchronous Programmed events that can cause a task switch 177 P. Reali / M. Corti protection (locks) acquire release synchronization wait on a condition send a signal (send-and-pass) System events that can cause a task switch voluntary switch ( yield, task termination) process with higher priority becomes available consumption of the allowed time quantum task preemption
6 Preemption Assign each process a time-quantum (normally in the order of tens of ms) Asynchronous task switches can happen at any time! task can be in the middle of a computation save whole CPU state (registers, flags,...) Perform switch on resource conflict on synchronization request on timer-interrupt (time-quantum is over) 178 P. Reali / M. Corti
7 Context switch Scheduler invocation: preemption interrupt cooperation explicit call Operations: store the process state (PC, regs, ) choose the next process (strategy) [accounting] restore the state of the next process (regs, SP, PC, ) jump to the restored PC A context switch is usually expensive: µs depending on the system and number of processes hardware optimizations (e.g., multiple sets of registers SPARC, DECSYSTEM-20) 179 P. Reali / M. Corti
8 Scheduling algorithms Three categories of environments: batch systems (e.g., VPP, DOS) usually non-preemptive (i.e., task is not stopped by scheduler, only synchronous switches) interactive systems (UNIX, Windows, Mac OS) cooperative or preemptive no task allowed to have the CPU forever real-time systems (PathWorks, RT Linux) timing constraints (deadlines, periodicity) 180 P. Reali / M. Corti
9 Scheduling Performance CPU utilization Throughput number of jobs per time unit minimize context switch penalty Turnaround time = exit time - arrival time execution, wait, I/O Response time = start time - request time Waiting time (I/O, waiting, ) Fairness 181 P. Reali / M. Corti
10 Scheduling algorithm goals All systems Fairness give every task a chance Policy enforcement Balance keep all subsystems busy Interactive systems Response time respond quickly Proportionality meet user s expectations Batch systems Throughput maximize number of jobs Turnaround time minimize time in system CPU utilization keep CPU busy Real-time systems Meet deadlines avoid losing data Predictability avoid degradation Hard- vs. soft-real-time systems 182 P. Reali / M. Corti
11 Batch Scheduling Algorithms Choose task to run (task is usually not preempted) First Come First Serve (FCFS) fair, may cause long waiting times Shortest Job First (SJF) requires knowledge about job length Longest Response Ratio response ratio = (time in the system / CPU time) depends on the waiting time Highest Priority First with or without preemption Mixed ETH-VPP is a batch system! Which algorithm does it use? the priority is adjusted dynamically (time in queue, length, priority, ) 183 P. Reali / M. Corti
12 Preemptive Scheduling Algorithms Time sharing Each task has a predefined time quantum Round-Robin Schedule next task on the ready list Quantum choice: small: may cause frequent switches big: may cause slow response P1 P4 P3 Implicit assumption: all task have same importance next P2 next 184 P. Reali / M. Corti
13 Preemptive Scheduling Algorithms Priority scheduling process with highest priority is scheduled first Variants multilevel queue scheduling one list per priority, use round-robin on list dynamic priorities proportional to time in system inversely proportional to part of quantum used make time quantum proportional to priority 185 P. Reali / M. Corti
14 Real-Time Scheduling Algorithms Task needs to meet the deadline! Task cost is known (should) Two task kind: aperiodic periodic Reservation scheduler decides if system has enough resources for the task Algorithms: Rate Monotonic Scheduling assign static priorities (priority proportional to frequency) Earliest Deadline First task with closest deadline is chosen 186 P. Reali / M. Corti
15 Summary & Admin Processes & Threads Multitasking context switch preemption cooperation Scheduling performance criteria algorithms Exercises: will take place tomorrow as usual :-) 187 P. Reali / M. Corti
16 Scheduling Algorithm Example Situation: Tasks P1, P2, P3, P4 Arrive at time t = 0 Priority: P1 highest, P4 lowest Time to process: 10, 2, 5, P. Reali / M. Corti
17 Scheduling Algorithm Example Highest Priority First P1 P2 P3 P turnaround = = response time = = P. Reali / M. Corti
18 Scheduling Algorithm Example Shortest Job First P1 P2 P3 P turnaround = = response time = = P. Reali / M. Corti
19 Scheduling Algorithm Example Timesharing with quantum = 2 P1 P2 P3 P turnaround = = response time = = P. Reali / M. Corti
20 Scheduling Algorithm Example Timesharing with quantum 0 P1 P2 P3 running at 1/4 running at 1/3 running at 1/2 P turnaround = response time = 0 = P. Reali / M. Corti
21 Scheduling Algorithm Example: Results Situation: Tasks P1, P2, P3, P4 Arrive at time t = 0 Priority: P1 highest, P4 lowest Time to process: 10, 2, 5, 3 Results turnaround response time Highest Priority First: Shortest Job First: Timesharing with Quantum = 2: Timesharing with Quantum 0: P. Reali / M. Corti
22 Scheduling Examples UNIX preemption 32 priority levels (round robin) each second the priorities are recomputed (CPU usage, nice level, last run) BSD similar every 4th tick priorities are recomputed (usage estimation) Windows NT real time priorities: fixed, may run forever variable: dynamic priorities, preemption idle: last choice (swap manager) 194 P. Reali / M. Corti
23 Scheduling Examples: Quantum & Priorities Win2K: quantum = 20ms (professional) 120ms (user), configurable depending on type (I/O bound) BSD: quantum = 100ms priority = f(load,nice,time last ) Linux: quantum = quantum / 2 + priority f(quantum, nice) 195 P. Reali / M. Corti
24 Scheduling Problems Starvation A task is never scheduled (although ready) fairness Deadlock No task is ready (nor it will ever become ready) detection+recovery or avoidance 196 P. Reali / M. Corti
25 Deadlock Conditions T Thread A holds R R1 B wants R R Resource A wants S T 1 T 2 R 2 B holds S Coffman conditions for a deadlock (1971): Mutual exclusion Hold and wait No resource preemption Circular wait (cycle) 197 P. Reali / M. Corti
26 Deadlock Remedies Coarser lock granularity: use a single lock for all resources (e.g., Linux Big Kernel Lock ) Locking order: resources are ordered resource locking according to the resource order (ticketing) Two-phase-locking: try to acquire all the resources if successful, lock them; otherwise free them and try again 198 P. Reali / M. Corti
27 Deadlock Detection, Prevention & Recovery Deadlock detection: the system keeps a graph of locks and tries to detect cycles. time consuming the graph has to be kept consistent with the actual state Deadlock prevention (avoidance): remove one of the four Coffman conditions cycles Recovery: kill processes and reclaim the resources rollback: requires to save the states of the processes regularly 199 P. Reali / M. Corti
28 Simple Deadlock Scenario Example Resources R, S, T Tasks A, B, C require { R, S }, { S, T }, { T, R } respectively Case 1: Sequential execution, no deadlock A B C +R +S -R -S +S +T -S -T +T +R -T -R 200 P. Reali / M. Corti
29 Simple Deadlock Scenario Case 2: Interleaving, deadlock A B C +R +S +T +S +T +R C R A T S B 201 P. Reali / M. Corti
30 Complex Deadlock Scenario Case with 6 resources and 7 tasks Thread holds requests A R S B - T C - S D U S, T E T V F W S G V U R C graphical representation A S F D U B T E V is this a case of deadlock? W G 202 P. Reali / M. Corti
31 Deadlock Avoidance Strategy in Bluebottle Timers Threads Processors Traps Each Kernel Module has a lock to protect its data Module Hierarchy Interrupts Blocks Locks Modules Memory Configuration When multiple locks are needed, acquire them according to the module hierarchy Module Lock 203 P. Reali / M. Corti
32 Priority Inversion A high-priority task can be blocked by a lower priority one. Example: High Medium Low waiting running ready 204 P. Reali / M. Corti
33 Priority Inversion Big problem for RTOS Solutions priority inheritance low-priority task holding resource inherits priority of highpriority task wanting the resource priority ceilings each resource has a priority corresponding to the highest priority of the users +1 the priority of the resource is transferred to the locking process can be used instead of semaphores 205 P. Reali / M. Corti
34 Example: Mars Pathfinder ( ) VxWorks real-time system: preemptive, priorities Communication bus: shared resource (mutexes) Low priority task (short): meteorological data gathering Medium priority task (long): communication High priority: bus manager Detection: watchdog on bus activity system reset Fix: activate priority inheritance via an uploaded onthe-fly patch (no memory protection). 206 P. Reali / M. Corti
35 Locking on Multiprocessor Machines Real parallelism! Cannot disable interrupts like on single processor machines (could stop every task, but not efficient) Software solutions Peterson, Dekker,... Hardware support bus locking atomic instructions (Test And Set, Compare And Swap) 207 P. Reali / M. Corti
36 Locking on multiprocessor machines Test And Set Compare and Swap (Intel) TAS s: CAS R1, R2, A: IF s = 0 THEN s := 1 ELSE CC := TRUE R1: expected value R2: new value A: address END IF R1 = M[A] THEN M[A] := R2; CC := TRUE ELSE R1 := M[A]; CC := FALSE END These instructions are atomic even on multiprocessors! The usually do so by locking the data bus 208 P. Reali / M. Corti
37 Example: Semaphores on SMP Counter s: available resources Binary Semaphores with TAS Spinning (busy wait) Try TAS s JMP Try CS TAS s JMP Queuing CS Blocking 209 P. Reali / M. Corti
38 Example: Semaphores on SMP Counter s: available resources Generic Semaphores with CAS P(s) Enter CS Exit CS V(s) P(S): { S := S - 1} IF S < 0 THEN jump queuing END Load R1 s TryP MOVE R1 R2 DEC R2 CAS R1, R2, s BNE TryP CMP R2, 0 BN Queuing [CS] V(S): { S := S + 1} IF S <= 0 THEN jump dequeuing END [CS] Load R1 s TryV MOVE R1 R2 INC R2 CAS R1, R2, s BNE TryV CMP R2, 0 BNP Dequeuing 210 P. Reali / M. Corti
39 Spin-Locks: the Bluebottle/i386 way PROCEDURE AcquireSpinTimeout(VAR locked: BOOLEAN); CODE {SYSTEM.i386} MOV EBX, locked[ebp] ; EBX := ADR(locked) MOV AL, 1 ; AL := 1 CLI ; switch interrupts off before ; acquiring lock test: XCHG [EBX], AL CMP AL, 1 JE test ; set and read the lock ; atomically. ; LOCK prefix implicit. ; was locked? ; retry.. END AcquireSpinTimeout; simplified version 211 P. Reali / M. Corti
40 Active Objects in Active Oberon State Method Object Activity Z = OBJECT VAR myt: T; I: INTEGER; PROCEDURE & NEW (t: T); BEGIN myt := t END NEW; PROCEDURE P (u: U; VAR v: V); BEGIN { EXCLUSIVE } i := 1 END P; BEGIN { ACTIVE } BEGIN { EXCLUSIVE } AWAIT (i > 0); END END Z; Initializer Mutual Exclusion Condition 212 P. Reali / M. Corti
41 Active Oberon Runtime Structures CPUs NIL 1 Running 2 Lock Queue Wait Queue Awaiting Object Awaiting Assertion Ready Ready Queue Ready 213 P. Reali / M. Corti
42 Active Oberon Implementation NEW Create object; Create process; Set to ready Preempt Set to ready; Run next ready END Run next ready Running 3 Awaiting Object 1 NIL 7 6 Awaiting Assertion 4 Ready 5 0 NIL 214 P. Reali / M. Corti
43 Active Oberon Implementation Enter Monitor IF monitor lock set THEN Put me in monitor obj wait list; Run next ready ELSE set monitor lock END Exit Monitor Find first asserted x in wait list; IF x found THEN set x to ready ELSE Find first x in obj wait list; IF x found THEN set x to ready ELSE clear monitor lock END END Run next ready 215 P. Reali / M. Corti Running Awaiting Object 1 NIL 7 Awaiting Assertion 4 Ready 5 0 NIL 6
44 Active Oberon Implementation NIL 7 2 Running 3 AWAIT Put me in monitor assn wait list; Call Exit monitor 3 Awaiting Object 1 6 Awaiting Assertion 4 Ready P. Reali / M. Corti NIL
45 Summary Scheduling algorithms examples Deadlocks Priority inversion Test & set instructions Case study: Active Oberon scheduler Next: Q&A Threads and locks: case studies File systems 217 P. Reali / M. Corti
46 [Q&A] Virtual Address Translations There is not a general scheme (or formula) valid for all architectures! General idea: Virtual address TLB Real address Page table Time (example): T := T TLB + (1" P TLBhit ) # (T PT + (1" P PThit ) # T disk ) 218 P. Reali / M. Corti
47 Case Study: Windows CE 3.0 Real-time constraints Reaction time on events Execution time Threads with priorities and time quanta Priorities: 0 (high),, 255 (low) Time quanta in ms Default 100 ms 0 no quantum Single processor p p q < p end of quantum 219 P. Reali / M. Corti
48 Case Study: Windows CE 3.0 Interrupt Handling ISR (Interrupt Service Routine) 1st level handling Kernel mode, uses kernel stack User Modus Installed at boot-time Creates event on-demand IST Preempted by ISR with higher priority IST (Interrupt Service Thread) 2nd level handling Event IRQ NK.EXE Event User mode Awaits events ISR Kernel Modus 220 P. Reali / M. Corti
49 Case Study: Windows CE 3.0 Synchronization on common resources: Critical sections: enter, leave operations Semaphores and mutexes (binary semaphores) [ CS ] [ ] [ ] Synchronization is performed with system/library calls (they are not part of a language). Priority inversion avoidance priority inheritance (thread inherits priority of task wanting the resource) 221 P. Reali / M. Corti
50 Case Study: Java Activities are mapped to threads (no processes) Synchronization in the language locks signals Threads provided by the library Scheduling depends on the JVM 222 P. Reali / M. Corti
51 Case Study: Java public class MyThread() extends Thread { } public void run() { System.out.println("Running"); } public static void main(string [] arguments) { MyThread t = (new MyStread()).start(); } 223 P. Reali / M. Corti
52 Case Study: Java public class MyThread() implements Runnable { } public void run() { System.out.println("Running"); } public static void main(string [] arguments) { Thread t = (new Thread(this)).start(); } 224 P. Reali / M. Corti
53 Case Study: Java Protection with monitor-like objects with method granularity public synchronized void somemethod() with statement granularity synchronized(anobject) {... } Synchronization with signals wait() (with optional time-out) notify() / notifyall() ( send and continue pattern) 225 P. Reali / M. Corti
54 Case Study: Java private Object o; public synchronized consume() { while (o == null) { try { wait(); } catch (InterruptedException e) {} } use(o); o = null; notifyall(); } public synchronized void produce(object p) { while (o!= null) { try { wait(); } catch (InterruptedException e) {} } o = p; notifyall(); } 226 P. Reali / M. Corti
55 Case Study: POSIX Threads Standard interface for threads in C Mostly UNIX, possible on Windows Provided by a library (libpthread) and not part of the language. IEEE POSIX c standard (1995) Various implementations (both user and kernel level) 227 P. Reali / M. Corti
56 Case Study: POSIX Threads #include <pthread.h> pthread_mutex_t m; void *run(){ pthread_mutex_lock(&m); // critical section pthread_mutex_unlock(&m); pthread_exit(null); } int main (int argc, char *argv[]){ pthread_t t; pthread_create(&t, NULL, run,null); pthread_exit(null); } 228 P. Reali / M. Corti
What s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable
What s An OS? Provides environment for executing programs Process abstraction for multitasking/concurrency scheduling Hardware abstraction layer (device drivers) File systems Communication Do we need an
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 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 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 informationPreview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System
Preview Process Scheduler Short Term Scheduler Long Term Scheduler Process Scheduling Algorithms for Batch System First Come First Serve Shortest Job First Shortest Remaining Job First Process Scheduling
More informationCSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.
CSC 4103 - Operating Systems Spring 2008 Lecture - XII Midterm Review Tevfik Ko!ar Louisiana State University March 4 th, 2008 1 I/O Structure After I/O starts, control returns to user program only upon
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 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 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 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 informationPROCESSES & THREADS. Charles Abzug, Ph.D. Department of Computer Science James Madison University Harrisonburg, VA Charles Abzug
PROCESSES & THREADS Charles Abzug, Ph.D. Department of Computer Science James Madison University Harrisonburg, VA 22807 Voice Phone: 540-568-8746; Cell Phone: 443-956-9424 E-mail: abzugcx@jmu.edu OR CharlesAbzug@ACM.org
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 informationProcesses Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.
Processes Prof. James L. Frankel Harvard University Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Process Model Each process consists of a sequential program
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 informationCISC 7310X. C05: CPU Scheduling. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/1/2018 CUNY Brooklyn College
CISC 7310X C05: CPU Scheduling Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/1/2018 CUNY Brooklyn College 1 Outline Recap & issues CPU Scheduling Concepts Goals and criteria
More informationMain Points of the Computer Organization and System Software Module
Main Points of the Computer Organization and System Software Module You can find below the topics we have covered during the COSS module. Reading the relevant parts of the textbooks is essential for a
More informationVerification of Real-Time Systems Resource Sharing
Verification of Real-Time Systems Resource Sharing Jan Reineke Advanced Lecture, Summer 2015 Resource Sharing So far, we have assumed sets of independent tasks. However, tasks may share resources to communicate
More informationMidterm Exam Amy Murphy 6 March 2002
University of Rochester Midterm Exam Amy Murphy 6 March 2002 Computer Systems (CSC2/456) Read before beginning: Please write clearly. Illegible answers cannot be graded. Be sure to identify all of your
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 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 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 informationCS370 Operating Systems Midterm Review
CS370 Operating Systems Midterm Review Yashwant K Malaiya Fall 2015 Slides based on Text by Silberschatz, Galvin, Gagne 1 1 What is an Operating System? An OS is a program that acts an intermediary between
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 informationWhat are they? How do we represent them? Scheduling Something smaller than a process? Threads Synchronizing and Communicating Classic IPC problems
Processes What are they? How do we represent them? Scheduling Something smaller than a process? Threads Synchronizing and Communicating Classic IPC problems Processes The Process Model a) Multiprogramming
More informationTimers 1 / 46. Jiffies. Potent and Evil Magic
Timers 1 / 46 Jiffies Each timer tick, a variable called jiffies is incremented It is thus (roughly) the number of HZ since system boot A 32-bit counter incremented at 1000 Hz wraps around in about 50
More informationCHAPTER 2: PROCESS MANAGEMENT
1 CHAPTER 2: PROCESS MANAGEMENT Slides by: Ms. Shree Jaswal TOPICS TO BE COVERED Process description: Process, Process States, Process Control Block (PCB), Threads, Thread management. Process Scheduling:
More informationCS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University
CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 The Process Concept 2 The Process Concept Process a program in execution
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 informationComputer Science 4500 Operating Systems
Computer Science 4500 Operating Systems Module 6 Process Scheduling Methods Updated: September 25, 2014 2008 Stanley A. Wileman, Jr. Operating Systems Slide 1 1 In This Module Batch and interactive workloads
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 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 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 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 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 informationCS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University
CS 571 Operating Systems Midterm Review Angelos Stavrou, George Mason University Class Midterm: Grading 2 Grading Midterm: 25% Theory Part 60% (1h 30m) Programming Part 40% (1h) Theory Part (Closed Books):
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 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 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 informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 Lecture 8 Threads and Scheduling Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ How many threads
More informationOperating System Review Part
Operating System Review Part CMSC 602 Operating Systems Ju Wang, 2003 Fall Virginia Commonwealth University Review Outline Definition Memory Management Objective Paging Scheme Virtual Memory System and
More informationLecture 9: Midterm Review
Project 1 Due at Midnight Lecture 9: Midterm Review CSE 120: Principles of Operating Systems Alex C. Snoeren Midterm Everything we ve covered is fair game Readings, lectures, homework, and Nachos Yes,
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 informationChapter 2 Processes and Threads
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 2 Processes and Threads The Process Model Figure 2-1. (a) Multiprogramming of four programs. (b) Conceptual model of four independent,
More informationCSE 4/521 Introduction to Operating Systems
CSE 4/521 Introduction to Operating Systems Lecture 9 CPU Scheduling II (Scheduling Algorithms, Thread Scheduling, Real-time CPU Scheduling) Summer 2018 Overview Objective: 1. To describe priority scheduling
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 informationCMPS 111 Spring 2003 Midterm Exam May 8, Name: ID:
CMPS 111 Spring 2003 Midterm Exam May 8, 2003 Name: ID: This is a closed note, closed book exam. There are 20 multiple choice questions and 5 short answer questions. Plan your time accordingly. Part I:
More informationChapter 5: Process Scheduling
Chapter 5: Process Scheduling Chapter 5: Process Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Thread Scheduling Operating Systems Examples Algorithm
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 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 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 informationCS450/550 Operating Systems
CS450/550 Operating Systems Lecture 2 Processes and Threads Palden Lama Department of Computer Science CS450/550 P&T.1 Review: Summary of Lecture 1 Two major OS functionalities: machine extension and resource
More informationECE 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 informationMultiprocessor and Real- Time Scheduling. Chapter 10
Multiprocessor and Real- Time Scheduling Chapter 10 Classifications of Multiprocessor Loosely coupled multiprocessor each processor has its own memory and I/O channels Functionally specialized processors
More informationOperating system concepts. Task scheduling
Operating system concepts Task scheduling Task scheduling (thread scheduling) Target of scheduling are ready tasks ACTIVE TASK BLOCKED TASKS PASSIVE TASKS READY TASKS Active task currently running on processor
More informationChapter 5: CPU Scheduling
Chapter 5: CPU Scheduling Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm Evaluation
More informationTasks. Task Implementation and management
Tasks Task Implementation and management Tasks Vocab Absolute time - real world time Relative time - time referenced to some event Interval - any slice of time characterized by start & end times Duration
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 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 informationChapter 5: CPU Scheduling. Operating System Concepts Essentials 8 th Edition
Chapter 5: CPU Scheduling Silberschatz, Galvin and Gagne 2011 Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating
More informationOS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions).
OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions). (a) (b) (c) (d) (e) (f) (g) (h) (i) T_ The two primary purposes of an operating
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 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 informationUnit 3 : Process Management
Unit : Process Management Processes are the most widely used units of computation in programming and systems, although object and threads are becoming more prominent in contemporary systems. Process management
More informationMARUTHI SCHOOL OF BANKING (MSB)
MARUTHI SCHOOL OF BANKING (MSB) SO IT - OPERATING SYSTEM(2017) 1. is mainly responsible for allocating the resources as per process requirement? 1.RAM 2.Compiler 3.Operating Systems 4.Software 2.Which
More informationSMD149 - Operating Systems
SMD149 - Operating Systems Roland Parviainen November 3, 2005 1 / 45 Outline Overview 2 / 45 Process (tasks) are necessary for concurrency Instance of a program in execution Next invocation of the program
More informationCS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University
CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 Process creation in UNIX All processes have a unique process id getpid(),
More informationProcess Coordination and Shared Data
Process Coordination and Shared Data Lecture 26 In These Notes... Sharing data safely When multiple threads/processes interact in a system, new species of bugs arise 1. Compiler tries to save time by not
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 informationCS 153 Design of Operating Systems Winter 2016
CS 153 Design of Operating Systems Winter 2016 Lecture 12: Scheduling & Deadlock Priority Scheduling Priority Scheduling Choose next job based on priority» Airline checkin for first class passengers Can
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 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 Comprehensive Exam. Spring Student ID # 3/16/2006
Operating Systems Comprehensive Exam Spring 2006 Student ID # 3/16/2006 You must complete all of part I (60%) You must complete two of the three sections in part II (20% each) In Part I, circle or select
More informationCS450/550 Operating Systems
CS450/550 Operating Systems Lecture 2 Processes and Threads Dr. Xiaobo Zhou Department of Computer Science CS450/550 P&T.1 Review: Summary of Lecture 1 Two major OS functionalities: machine extension and
More informationScheduling Mar. 19, 2018
15-410...Everything old is new again... Scheduling Mar. 19, 2018 Dave Eckhardt Brian Railing Roger Dannenberg 1 Outline Chapter 5 (or Chapter 7): Scheduling Scheduling-people/textbook terminology note
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 informationUNIT:2. Process Management
1 UNIT:2 Process Management SYLLABUS 2.1 Process and Process management i. Process model overview ii. Programmers view of process iii. Process states 2.2 Process and Processor Scheduling i Scheduling Criteria
More informationOperating Systems CS 323 Ms. Ines Abbes
Taibah University College of Community of Badr Computer Science Department Operating Systems CS71/CS72 جامعة طيبة كلية المجتمع ببدر قسم علوم الحاسب مقرر: نظم التشغيل Operating Systems CS 323 Ms. Ines Abbes
More informationCS533 Concepts of Operating Systems. Jonathan Walpole
CS533 Concepts of Operating Systems Jonathan Walpole Introduction to Threads and Concurrency Why is Concurrency Important? Why study threads and concurrent programming in an OS class? What is a thread?
More informationCS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio
CS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio Fall 2017 1 Outline Inter-Process Communication (20) Threads
More informationCSE 153 Design of Operating Systems
CSE 153 Design of Operating Systems Winter 2018 Midterm Review Midterm in class on Monday Covers material through scheduling and deadlock Based upon lecture material and modules of the book indicated on
More informationMicrokernel/OS and Real-Time Scheduling
Chapter 12 Microkernel/OS and Real-Time Scheduling Hongwei Zhang http://www.cs.wayne.edu/~hzhang/ Ack.: this lecture is prepared in part based on slides of Lee, Sangiovanni-Vincentelli, Seshia. Outline
More informationMidterm Exam. October 20th, Thursday NSC
CSE 421/521 - Operating Systems Fall 2011 Lecture - XIV Midterm Review Tevfik Koşar University at Buffalo October 18 th, 2011 1 Midterm Exam October 20th, Thursday 9:30am-10:50am @215 NSC Chapters included
More informationCS2506 Quick Revision
CS2506 Quick Revision OS Structure / Layer Kernel Structure Enter Kernel / Trap Instruction Classification of OS Process Definition Process Context Operations Process Management Child Process Thread Process
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 informationOperating Systems: Quiz2 December 15, Class: No. Name:
Operating Systems: Quiz2 December 15, 2006 Class: No. Name: Part I (30%) Multiple Choice Each of the following questions has only one correct answer. Fill the correct one in the blank in front of each
More informationScheduling. Scheduling 1/51
Scheduling 1/51 Scheduler Scheduling Scheduler allocates cpu(s) to threads and processes. This action is known as scheduling. The scheduler is a part of the process manager code that handles scheduling.
More informationLecture 17: Threads and Scheduling. Thursday, 05 Nov 2009
CS211: Programming and Operating Systems Lecture 17: Threads and Scheduling Thursday, 05 Nov 2009 CS211 Lecture 17: Threads and Scheduling 1/22 Today 1 Introduction to threads Advantages of threads 2 User
More informationCSE 120. Summer, Inter-Process Communication (IPC) Day 3. Inter-Process Communication (IPC) Scheduling Deadlock. Instructor: Neil Rhodes
CSE 120 Summer, 2005 Inter-Process Communication (IPC) Day 3 Inter-Process Communication (IPC) Scheduling Deadlock Instructor: Neil Rhodes Inter-Process Communication Cooperating processes must communicate
More informationProcesses and Threads
Processes and Threads Giuseppe Anastasi g.anastasi@iet.unipi.it Pervasive Computing & Networking Lab. () Dept. of Information Engineering, University of Pisa Based on original slides by Silberschatz, Galvin
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2019 Lecture 8 Scheduling Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ POSIX: Portable Operating
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 informationLecture 2 Process Management
Lecture 2 Process Management Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks The terms job and process may be interchangeable
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 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 informationOperating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017
Operating Systems Lecture 4 - Concurrency and Synchronization Adrien Krähenbühl Master of Computer Science PUF - Hồ Chí Minh 2016/2017 Mutual exclusion Hardware solutions Semaphores IPC: Message passing
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 informationCHAPTER NO - 1 : Introduction:
Sr. No L.J. Institute of Engineering & Technology Semester: IV (26) Subject Name: Operating System Subject Code:21402 Faculties: Prof. Saurin Dave CHAPTER NO - 1 : Introduction: TOPIC:1 Basics of Operating
More informationProcess & Thread Management II. Queues. Sleep() and Sleep Queues CIS 657
Process & Thread Management II CIS 657 Queues Run queues: hold threads ready to execute Not a single ready queue; 64 queues All threads in same queue are treated as same priority Sleep queues: hold threads
More informationProcess & Thread Management II CIS 657
Process & Thread Management II CIS 657 Queues Run queues: hold threads ready to execute Not a single ready queue; 64 queues All threads in same queue are treated as same priority Sleep queues: hold threads
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 information