Project 2: Preemption CS 4411 Spring 2017

Slides:



Advertisements
Similar presentations
Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
Advertisements

Operating Systems Process Scheduling (Ch 3.2, )
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 17 Scheduling III.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Chapter 6a: CPU Scheduling.
A. Frank - P. Weisberg Operating Systems Advanced CPU Scheduling.
Operating System Process Scheduling (Ch 4.2, )
Operating System I Process Scheduling. Schedulers F Short-Term –“Which process gets the CPU?” –Fast, since once per 100 ms F Long-Term (batch) –“Which.
Chapter 2: Processes Topics –Processes –Threads –Process Scheduling –Inter Process Communication (IPC) Reference: Operating Systems Design and Implementation.
Scheduling in Batch Systems
Project 2 – solution code
Preemptive Minithreads Tom Roeder CS sp. Multi-level Feedback Queues Quantum = 2 Quantum = 4 Quantum = 8 Quantum = 16 Lowest priority Highest priority.
Operating Systems Process Scheduling (Ch 4.2, )
Scheduling. Model of Process Execution Ready List Ready List Scheduler CPU Resource Manager Resource Manager Resources Preemption or voluntary yield AllocateRequest.
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
Scheduling Strategies Operating Systems Spring 2004 Class #10.
Classification of scheduling policies Preemptive methods (typical representative: RR) Non-preemptive methods (typical representative: FCFS) Preemption.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
1 Uniprocessor Scheduling Chapter 9. 2 Aim of Scheduling Response time Throughput Processor efficiency.
Cpr E 308 Spring 2005 Process Scheduling Basic Question: Which process goes next? Personal Computers –Few processes, interactive, low response time Batch.
CS333 Intro to Operating Systems Jonathan Walpole.
TANNENBAUM SECTION 2.4, 10.3 SCHEDULING OPERATING SYSTEMS.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
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.
CPU SCHEDULING.
Chapter 6: CPU Scheduling
Chapter 5a: CPU Scheduling
April 6, 2001 Gary Kimura Lecture #6 April 6, 2001
Threads, Events, and Scheduling
Operating Systems Processes Scheduling.
Uniprocessor Scheduling
Real-time Software Design
Process Scheduling B.Ramamurthy 9/16/2018.
Chapter 6: CPU Scheduling
Process management Information maintained by OS for process management
CPU Scheduling Basic Concepts Scheduling Criteria
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
COT 4600 Operating Systems Spring 2011
Andy Wang Operating Systems COP 4610 / CGS 5765
Operating System Concepts
Processor Fundamentals
Lecture 17 Syed Mansoor Sarwar
Scheduling.
Chapter 5: CPU Scheduling
Chapter 9 Uniprocessor Scheduling
Outline Scheduling algorithms Multi-processor scheduling
CPU scheduling decisions may take place when a process:
Threads, Events, and Scheduling
COT 4600 Operating Systems Fall 2009
Process Scheduling Decide which process should run and for how long
CS703 – Advanced Operating Systems
Threads, Events, and Scheduling
Processor Scheduling Hank Levy 1.
Process Scheduling B.Ramamurthy 4/11/2019.
Process Scheduling B.Ramamurthy 4/7/2019.
Shortest-Job-First (SJR) Scheduling
Concurrency and Threading: CPU Scheduling
Chapter 6: Scheduling Algorithms Dr. Amjad Ali
Scheduling 21 May 2019.
Uniprocessor Scheduling
CSE 153 Design of Operating Systems Winter 2019
Uniprocessor Scheduling
CPU Scheduling: Basic Concepts
Linux Scheduling CSE 2431: Introduction to Operating Systems
Presentation transcript:

Project 2: Preemption CS 4411 Spring 2017 xkcd.com/1542

Administrative Information Project 1 is still being graded – results should be ready by beginning of next week. Project 2 will be due Fri 3/3.

Fix Project 1 Bugs!!!! First Step OS prac builds on each project, and P1 is literally the foundation of everything.

Purpose Made a major assumption in Project 1 Threads behave nicely and yield CPU Issues? Selfish Threads Starvation Need the ability to interrupt running threads… Selfish Threads

P2 Overview Three main parts of P2: Receive Clock Interrupts Add Alarms Allow threads to sleep Multilevel Feedback Queue Scheduler

Introducing Interrupts Every clock tick the interrupt handler will be called. Allows us to schedule a new thread to be run without relying on nice behavior.

Disabling Interrupts For operations that must be atomic Typically when working with shared data structures. E.g. Modifying the cleanup queue. Trivial way of achieving correctness: disable interrupts for everything. Why is this a bad idea?

Interrupt Handler - Reminder Just a function that runs when an interrupt occurs. Are there problems if the interrupt handler is interrupted? Yes – accessing shared data structures Solution – disable interrupt in the interrupt handler CANNOT BLOCK

Alarms Alarms = Schedule a function for future execution minithread_sleep() Timeouts Each alarms requires a call back function Call back functions might not be executed by the thread that registered the alarm!

Performance Matters! Remember, checking alarms will take place inside your interrupt handler. How long does it take to find an element in your Project 1 queue? We need a different approach. You may add extra functionality to your Project 1 queue Some sort of queue where elements have different priorities

Scheduling: FIFO Now lets talk about scheduling Suppose our strategy is FIFO (like in P1) What problems can arise? CPU bound vs IO bound Ice cream analogy, or counting words vs moving your mouse

Shortest Job First Suppose our strategy is shortest job first What problems can arise?

What we want Goals: - Short jobs added later don’t starve due to long jobs added earlier - Long jobs don’t get perpetually starved if short jobs keep coming in Also, how do we even know how long a job will take????

Introducing the Multi Level Queue! Round Robin Highest Round Robin Round Robin Idea: Jobs start at highest priority because we have no idea how long it will take Round Robin Lowest

Scheduling Total 80 quanta – 1 quanta per thread 1 2 Two numbers, First how long does the CPU spend in that level, then how long does the CPU run each individual thread for in that level 3 Do we achieve our goals?

Scheduling If there are no threads in a given level, schedule threads from the next available level Threads are demoted after using up their time for that level Thread level starts at 0 and can only increase throughout its lifetime.

Testing There are a lot of parts to this project Common pitfalls Multi-level queue Interrupts Alarms Thread levels Common pitfalls Unnecessarily disabling interrupts Not disabling interrupts when necessary Multi-level queue corner cases

Questions Questions?

Project 2 FAQ All library calls are safe: interrupts are automatically disabled upon calling interrupts will be restored to its original state (enabled/disabled) after the call. Units of time PERIOD is defined as 50 ms, which is 50000 as a constant. Alarm and wakeup delays are specified in milliseconds. You have to convert units; don’t blindly subtract PERIOD. Irregular/random clock interrupts This is normal Be careful of introducing heisenbugs because of your debug statements.