Preemptive Scheduling Vivek Pai / Kai Li Princeton University.

Slides:



Advertisements
Similar presentations
Operating Systems ECE344 Midterm review Ding Yuan
Advertisements

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
CAS3SH3 Midterm Review. The midterm 50 min, Friday, Feb 27 th Materials through CPU scheduling closed book, closed note Types of questions: True & False,
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Process Description and Control
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
1: Operating Systems Overview
1 CS 333 Introduction to Operating Systems Class 2 – OS-Related Hardware & Software The Process Concept Jonathan Walpole Computer Science Portland State.
1/27/2010CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying an earlier version.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
Forking & Process Scheduling Vivek Pai / Kai Li Princeton University.
1/23/2008CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
CSE451 Processes Spring 2001 Gary Kimura Lecture #4 April 2, 2001.
Processes April 5, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
Preemptive Scheduling Vivek Pai / Kai Li Princeton University.
CPS110: Implementing threads/locks on a uni-processor Landon Cox.
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
Operating Systems CSE 411 CPU Management Sept Lecture 11 Instructor: Bhuvan Urgaonkar.
CE Operating Systems Lecture 5 Processes. Overview of lecture In this lecture we will be looking at What is a process? Structure of a process Process.
MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)
LOGO OPERATING SYSTEM Dalia AL-Dabbagh
Operating System Review September 10, 2012Introduction to Computer Security ©2004 Matt Bishop Slide #1-1.
CSC 501 Lecture 2: Processes. Process Process is a running program a program in execution an “instantiation” of a program Program is a bunch of instructions.
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
Threads Many software packages are multi-threaded Web browser: one thread display images, another thread retrieves data from the network Word processor:
Implementing Processes and Process Management Brian Bershad.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Chapter 3 Process Description and Control
Mutual Exclusion. Readings r Silbershatz: Chapter 6.
Operating Systems CSE 411 Multi-processor Operating Systems Multi-processor Operating Systems Dec Lecture 30 Instructor: Bhuvan Urgaonkar.
Concurrency & Context Switching Process Control Block What's in it and why? How is it used? Who sees it? 5 State Process Model State Labels. Causes of.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Managing Processors Jeff Chase Duke University. The story so far: protected CPU mode user mode kernel mode kernel “top half” kernel “bottom half” (interrupt.
CPU Scheduling Operating Systems CS 550. Last Time Deadlock Detection and Recovery Methods to handle deadlock – Ignore it! – Detect and Recover – Avoidance.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Scheduler activations Landon Cox March 23, What is a process? Informal A program in execution Running code + things it can read/write Process ≠
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.
SLC/VER1.0/OS CONCEPTS/OCT'99 1Processes Process Concept Process Scheduling Operation On Processes Cooperating Processes Threads Interprocess Communication.
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Processes and threads.
Operating Systems CMPSC 473
CS 6560: Operating Systems Design
OPERATING SYSTEMS CS3502 Fall 2017
Scheduler activations
Lecture Topics: 11/1 Processes Process Management
Day 08 Processes.
Day 09 Processes.
Lecture 21 Concurrency Introduction
Operating Systems CPU Scheduling.
Lecture 21: Introduction to Process Scheduling
Process & its States Lecture 5.
Lecture Topics: 11/1 General Operating System Concepts Processes
Process Description and Control
Processes Hank Levy 1.
Processes and Process Management
EE 472 – Embedded Systems Dr. Shwetak Patel.
Lecture 21: Introduction to Process Scheduling
CSE 153 Design of Operating Systems Winter 2019
Processes Hank Levy 1.
CS703 – Advanced Operating Systems
CSE 153 Design of Operating Systems Winter 2019
Chapter 3: Process Management
Presentation transcript:

Preemptive Scheduling Vivek Pai / Kai Li Princeton University

2 Overview for Today Wrap up regular scheduling Move on to pre-emptive scheduling Discuss scheduling project Reading assignments missing Will be added to web page soon

3 Rethinking Your Server Server: Accept connection User: Send request Server: Send (possibly long) response User: Receive response Both: Disconnect

4 Drawbacks… Server: Accept connection User: Send request Server: Send (possibly long) response User: Receive response Both: Disconnect No control over time

5 What’s the Simplest Option? While (1) accept new connection fork new process let process handle connection Drawback: lots of process creation/deletion

6 Can We Reduce Forks? At program launch, fork some number While (1) accept wait for hello wait for goodbye close Note: wait = implicit yield

7 But What If We Do More While (1) accept wait for hello perform possibly unbounded calculation wait for goodbye close Problem: when do we yield?

8 Signals and Interrupts Both are asynchronous Used to notify system of event occurrence Signal – delivered by OS to process Interrupt – delivered by hardware to OS Some overlap/interaction? Definitely Examples? Code tries executing divide-by-zero User disconnects (hangs up)

9 I/O and Timer Interrupts Why Timer interrupt to do CPU management Asynchronous I/O to overlap with computation Interrupt Between instructions Within an instruction Enable and disable CPU Memory Interrupt

10 Using Interrupts For Scheduling Timer interrupt Generated by hardware Assume changing requires privilege Delivered to the OS Main idea Before moving process to running, set timer If process yields/blocks, clear timer Timer expires? Go to scheduler

11 Scheduling Considerations Timer granularity Finer timers = more responsive Coarse timers = more efficient Accounting Cheap Accurate Fair – consider I/O versus CPU applications

12 Preemptive Scheduling Running Blocked Ready I/O completion interrupt (move to ready queue) Create Terminate (call scheduler) Yield, Timer Interrupt (call scheduler) Block for resource (call scheduler) Scheduler dispatch

13 No Control Over Yielding Reasons for yielding Timer goes off Higher-priority interrupt occurs Higher-priority process becomes ready Some unintentional block (e.g. page fault)

14 “Atomic” Pieces of Code Example: bank transaction Read account balance Add/subtract money Write account balance Problem: what happens when two transactions are being posted to the same account?

15 Next Time Atomic pieces known as critical sections Very common in concurrent/parallel programming Must share memory Possible via forked processes Default via threads Cover some scheduling policies