Review: Process Communication Sequential Communication –Result of P1 becomes at termination the input to P2 –Tools: Redirect (>,>>) and Pipe (|) Concurrent.

Slides:



Advertisements
Similar presentations
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Advertisements

Operating Systems Chapter 6
Chapter 3: CPU Scheduling
Chapter 2: Processes Topics –Processes –Threads –Process Scheduling –Inter Process Communication (IPC) Reference: Operating Systems Design and Implementation.
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
Review: Process Management Objective: –Enable fair multi-user, multiprocess computing on limited physical resources –Security and efficiency Process: running.
Project 2 – solution code
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
OS Spring ’ 04 Scheduling Operating Systems Spring 2004.
Review: Operating System Manages all system resources ALU Memory I/O Files Objectives: Security Efficiency Convenience.
What we will cover…  CPU Scheduling  Basic Concepts  Scheduling Criteria  Scheduling Algorithms  Evaluations 1-1 Lecture 4.
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (2) Process Management 10/03/2008 Yang Song (Prepared by Yang Song and.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
02/11/2004CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
CPU-Scheduling Whenever the CPU becomes idle, the operating system must select one of the processes in the ready queue to be executed. The short term scheduler.
Recall … Process states –scheduler transitions (red) Challenges: –Which process should run? –When should processes be preempted? –When are scheduling decisions.
Chapter 6: CPU Scheduling
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
Chapter 4 Processor Management
More Scheduling cs550 Operating Systems David Monismith.
1 Scheduling Processes. 2 Processes Each process has state, that includes its text and data, procedure call stack, etc. This state resides in memory.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
1 CSE451 Scheduling Autumn 2002 Gary Kimura Lecture #6 October 11, 2002.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
Alternating Sequence of CPU And I/O Bursts. Histogram of CPU-burst Times.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
Cpr E 308 Spring 2004 Real-time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 7: CPU Scheduling Chapter 5.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
CSC 322 Operating Systems Concepts Lecture - 10: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
Processor Scheduling Hank Levy. 22/4/2016 Goals for Multiprogramming In a multiprogramming system, we try to increase utilization and thruput by overlapping.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
CS333 Intro to Operating Systems Jonathan Walpole.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
CPU Scheduling Operating Systems CS 550. Last Time Deadlock Detection and Recovery Methods to handle deadlock – Ignore it! – Detect and Recover – Avoidance.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
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.
Lecture 12 Scheduling Models for Computer Networks Dr. Adil Yousif.
Process Scheduling. Scheduling Strategies Scheduling strategies can broadly fall into two categories  Co-operative scheduling is where the currently.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
Basic Concepts Maximum CPU utilization obtained with multiprogramming
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
CPU Scheduling Scheduling processes (or kernel-level threads) onto the cpu is one of the most important OS functions. The cpu is an expensive resource.
Networks and Operating Systems: Exercise Session 2
Chapter 2 Scheduling.
Lecture 23: Process Scheduling for Interactive Systems
MODERN OPERATING SYSTEMS Third Edition ANDREW S
CPU Scheduling Basic Concepts Scheduling Criteria
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Lecture 21: Introduction to Process Scheduling
Operating System Concepts
Operating systems Process scheduling.
CSE 451: Operating Systems Winter 2003 Lecture 6 Scheduling
Lecture 21: Introduction to Process Scheduling
Scheduling.
Scheduling 21 May 2019.
Prof. Deptii Chaudhari.
CSE 153 Design of Operating Systems Winter 2019
Don Porter Portions courtesy Emmett Witchel
CSE 451: Operating Systems Winter 2001 Lecture 6 Scheduling
Presentation transcript:

Review: Process Communication Sequential Communication –Result of P1 becomes at termination the input to P2 –Tools: Redirect (>,>>) and Pipe (|) Concurrent Communication –between 2 running processes via shared resources Resource Sharing –Each resource has a Boolean variable associated –A process can request a resource and set the lock = 1 –To free a resource lock = 0 –Usually you only lock a resource if you want to change it

Problems of Sharing Resources Inconsistency –Unpredictable and wrong behavior (example of printer queue with lost job) Deadlock – Processes are waiting for resources held by another Race conditions –Conditions under which sharing can lead to inconsistencies and deadlock

Solutions Inconsistency can be avoided by ensuring uninterrupted blocks of instructions Preventive: –Test and Set Instruction –Semaphores –Critical Block Detect and resolve

The Dining Philosophers P1 P4 P3 P2 P5 Plate with food Fork F1 F5 F4 F3 F2

Detection for the Philosophers 5 Processes (Philosophers): P1, P2, P3, P4, P5 5 Resources (Forks): F1, F2, F3, F4, F5 Implementation of P: –think; –grab_left_fork; –grab_right_fork; –eat; –free_right_fork; –free_left_fork; Task: draw the dependency graph

Dependency Graph F1 F5 F4 F3 F2

Example for Dependency Graph Notation: R(resource) = request/lock F(resource) = free resource P1: R(a),R(b),R(c),F(c),R(d),F(b),F(d),F(a,) P2: R(e),R(d),R(c),F(c),F(d),F(e) P3: R(a),R(d),R(e),F(a),F(d),F(e) P4: R(c),R(k),R(a),F(a),F(k),F(c) Question: Which process (P2,P3,P4) can you let run without danger of deadlock

Solution Please copy the graph from the board! You can’t run the following combinations: –P2,P3 –P1,P4

Use of Dependency Graph Prevention: the OS does not allow a process to start if it could create a deadlock –this is in some cases a overly conservative and in some sense unfair policy –the implementation of this policy is computationally very expensive! Detection: wait for deadlock to happen –If a number of processes seem to be waiting beyond a certain timelimit, build the graph including the ownership of resources and select a process such that killing it will break the circle

Process Scheduling Scheduler decides: –Which process in ready queue is next to run –When to stop a running process

Scheduling Main Constraint: Every switch has overhead Scheduling objectives depend on environment –Batch systems: High performance computing, Server Throughput: maximize jobs per time Turnaround time: minimize time between creation and termination –User interactive systems: Eureka or Sales Response Time Fairness

Batch Systems Processes are executed sequentially to minimize switching overhead (no timeout arrow) When to stop a running process: Only if it is waiting for I/O Which process to run next: –First comes first serves Fair, but can lead to long waiting of minor jobs –Shortest job next assumes runtime is known, penalizes long jobs

Batch Example Processes arriving in the following order: –A(20s) at t=10,B(14000s) at t=20,C(10s) at t=25, D(5s) at t = 30 –CPU currently runs E and terminates at t=18 Execution Order for First-comes first-serves –A, B, C, D Execution Order for Shortest First –A (terminates at 28), C (terminates at 38), D (terminates at 43), B (terminates at 14043)

Interactive Systems: Multiprogramming Each process is allowed to run for a certain time (quantum) after which it is interrupted Parameter: quantum length (e.g., 25ms) –Too small: big overhead due to context switch(e.g., 1ms) –Too big: low response time (wait to see character you typed) Scheduling Schemes: –Round Robin Scheduling –Priority Scheduling –Lottery Scheduling

Round Robin Simplest –Scheduler has ready queue with first in first out –When interrupted: after timeout (quantum is over) –Which next: next in queue T1 A T2 Running Ready Queue B BCDECDEA

Priority Scheduling Disadvantage of Round Robin: –Even very important jobs wait in line Alternative: multiple ready queues for different priority classes –Round robin for jobs in highest priority queue –Only if empty it picks from the next lower priority –Works well if there are few priority classes and few high priority jobs –Can starve low priority jobs

Example Priority Quantum = 10 sec, Switch cost = 1 sec Priority Levels: 0, 1, 2 where 2 is highest CPU started at t=0 to run A (p=0, t=30) at t=5 arrives B (p=1, t=20) at t=15 arrives C (p=1, t=20) at t=25 arrives D (p=2, t=5) Task: draw timeline of execution –Solution: A, B, C, D, B, C, A, A

Lottery Scheduling Similar to Priority Scheduling Multiple queue for different priorities Every process that is next in his queue gets a lottery ticket High priority jobs get more lottery tickets OS picks a ticket to determine the next job Higher priority has a higher probability to be executed next but you don’t starve low priority jobs

What you should be able to do Draw dependency graph from process specification and determine whether there is a chance of deadlock and which processes you can run safe together Determine execution order for batch (first comes first serves, shortest first), Round Robin and Priority Scheduling