Roadmap. Multilevel Queue Scheduling. Multilevel Queue. Example of Multilevel Feedback Queue. Multilevel Feedback Queue. Tevfik Ko!

Similar documents
Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - VII CPU Scheduling - II. Louisiana State University

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - III Processes. Louisiana State University. Virtual Machines Processes

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - II OS Structures. University at Buffalo. OS Design and Implementation

OS Design Approaches. Roadmap. System Calls. Tevfik Koşar. Operating System Design and Implementation. CSE 421/521 - Operating Systems Fall 2013

CSC Operating Systems Spring Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. January 17 th, 2007.

Announcements. Operating System Structure. Roadmap. Operating System Structure. Multitasking Example. Tevfik Ko!ar

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

Chapter 2: Operating-System Structures

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - X Deadlocks - II. Louisiana State University. Deadlocks

Chapter 6: CPU Scheduling

Chapter 2: Operating-System Structures. Chapter 2: Operating-System Structures. Objectives. Operating System Services

CPU Scheduling Algorithms

TDDI04, K. Arvidsson, IDA, Linköpings universitet Operating System Structures. Operating System Structures Overview. Operating System Services

Chapter 5: CPU Scheduling

Operating-System Structures

Properties of Processes

CSE 421/521 - Operating Systems Fall Lecture - VII CPU Scheduling - II. University at Buffalo

CHAPTER 2: PROCESS MANAGEMENT

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Operating System Services

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009

CSC Operating Systems Fall Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. August 27 th, 2009.

Announcements. Computer System Organization. Roadmap. Major OS Components. Processes. Tevfik Ko!ar. CSC Operating Systems Fall 2009

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - XI Deadlocks - II. University at Buffalo. Deadlocks. October 6 th, 2011

Lecture 2 Process Management

Four Components of a Computer System. Operating System Concepts 7 th Edition, Jan 12, 2005

Operating System Concepts Ch. 5: Scheduling

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Four Components of a Computer System

Objectives. Chapter 2: Operating-System Structures. 2.1 Operating System Services

Chapter 5: CPU Scheduling. Operating System Concepts Essentials 8 th Edition

CS370 Operating Systems

Operating-System Structures

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - XIV Virtual Memory - I. Louisiana State University.

OS Design Approaches. Roadmap. OS Design Approaches. Tevfik Koşar. Operating System Design and Implementation

CS370 Operating Systems

CPU Scheduling: Objectives

CS370 Operating Systems

Chapter 2: Operating-System Structures. Operating System Concepts Essentials 8 th Edition

Chapter 2: Operating-System Structures

Chapter 2: Operating-System

Chapter 6: CPU Scheduling

Module 3: Operating-System Structures

Processes and Threads

LECTURE 3:CPU SCHEDULING

Chapter 3: Operating-System Structures

Chapter 2: Operating-System Structures

OS and Computer Architecture. Chapter 3: Operating-System Structures. Common System Components. Process Management

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms

! The Process Control Block (PCB) " is included in the context,

Last class: OS and Architecture. OS and Computer Architecture

Last class: OS and Architecture. Chapter 3: Operating-System Structures. OS and Computer Architecture. Common System Components

Chapter 3: Operating-System Structures

CSC Operating Systems Fall Lecture - XII Deadlocks - III. Tevfik Ko!ar. Louisiana State University. October 6 th, 2009

CS420: Operating Systems. OS Services & System Calls

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Chapter 2: Operating-System Structures

CSC Operating Systems Spring Lecture - XIV Virtual Memory - II. Tevfik Ko!ar. Louisiana State University. March 27 th, 2008.

Chapter 5: CPU Scheduling

CS370 Operating Systems

CS307: Operating Systems

Chapter 5 CPU scheduling

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Lecture 2 - Fundamental Concepts

Operating-System Structures

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)

CSE 421/521 - Operating Systems Fall Lecture - XII Main Memory Management. Tevfik Koşar. University at Buffalo. October 18 th, 2012.

OPERATING SYSTEMS UNIT - 1

ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far.

CSC Operating Systems Fall Lecture - I Introduction. Tevfik Ko!ar. Louisiana State University. August 25 th, Contact Information

CPU Scheduling. Basic Concepts. Histogram of CPU-burst Times. Dispatcher. CPU Scheduler. Alternating Sequence of CPU and I/O Bursts

Last class: Today: CPU Scheduling. CPU Scheduling Algorithms and Systems

TDIU25: Operating Systems II. Processes, Threads and Scheduling

Roadmap. Deadlock Prevention. Deadlock Prevention (Cont.) Deadlock Detection. Exercise. Tevfik Koşar. CSE 421/521 - Operating Systems Fall 2012

Overview of Mass Storage Structure

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Scheduling (Win 2K) CSE Computer Systems November 21, 2001

CS370 Operating Systems

Roadmap. Tevfik Koşar. CSC Operating Systems Spring Lecture - XII Main Memory - II. Louisiana State University

Module 1 Introduction/OS Overview

Chapter 5: CPU Scheduling. Operating System Concepts 8 th Edition,

Operating Systems CS 323 Ms. Ines Abbes

Module 3: Operating-System Structures. Common System Components

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009

Chapter 1: Introduction. Operating System Concepts 8 th Edition,

2/14/2012. Using a layered approach, the operating system is divided into N levels or layers. Also view as a stack of services

Chapter 5 Process Scheduling

Job Scheduling. CS170 Fall 2018

Exercise (could be a quiz) Solution. Concurrent Programming. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - IV Threads

Process- Concept &Process Scheduling OPERATING SYSTEMS

Chapter 5: Process Scheduling

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edit9on

CPSC 341 OS & Networks. Introduction. Dr. Yingwu Zhu

Chapter 5: CPU Scheduling

CPU Scheduling. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

CS3733: Operating Systems

Lecture 2 Operating System Structures (chapter 2)

Chapter 3: Operating-System Structures

1. Introduction to Operating Systems

Transcription:

CSC 4103 - Operating Systems Fall 2009 Lecture - VII CPU Scheduling - II Roadmap Multilevel Feedback Queues Estimating CPU bursts Project Discussion System Calls Virtual Machines Tevfik Ko!ar Louisiana State University September 14 th, 2009 1 2 Multilevel Queue Multilevel Queue Scheduling Ready queue is partitioned into separate queues: foreground (interactive) background (batch) Each queue has its own scheduling algorithm foreground RR background FCFS Scheduling must be done between the queues Fixed priority scheduling; (i.e., serve all from foreground then from background). Possibility of starvation. Time slice each queue gets a certain amount of CPU time which it can schedule amongst its processes; i.e., 80% to foreground in RR, 20% to background in FCFS 3 4 Multilevel Feedback Queue Example of Multilevel Feedback Queue A process can move between the various queues; aging can be implemented this way Multilevel-feedback-queue scheduler defined by the following parameters: number of queues scheduling algorithms for each queue method used to determine when to upgrade a process method used to determine when to demote a process method used to determine which queue a process will enter when that process needs service Three queues: Q 0 RR with time quantum 8 milliseconds Q 1 RR time quantum 16 milliseconds Q 2 FCFS Scheduling A new job enters queue Q 0 which is served FCFS. When it gains CPU, job receives 8 milliseconds. If it does not finish in 8 milliseconds, job is moved to queue Q 1. At Q 1 job is again served FCFS and receives 16 additional milliseconds. If it still does not complete, it is preempted and moved to queue Q 2. 5 6

Multilevel Feedback Queues Determining Length of Next CPU Burst Can only estimate the length Can be done by using the length of previous CPU bursts, using exponential averaging + 7 8 Examples of Exponential Averaging Exercise! =0 " n+1 = " n Recent history does not count! =1 " n+1 =! t n Only the actual last CPU burst counts If we expand the formula, we get: " n+1 =! t n +(1 -!)! t n -1 + +(1 -! ) j! t n -j + +(1 -! ) n +1 " 0 Since both! and (1 -!) are less than or equal to 1, each successive term has less weight than its predecessor 9 10 Prediction of the Length of the Next CPU Burst Project Discussion Alpha = 1/2, T0 = 10 11 12

System Calls! Location of the system calls in the Computing System OS API: System Calls user space kernel space System calls Tanenbaum, A. S. (2001) Modern Operating Systems (2nd Edition). The system calls are the mandatory interface between the user programs and the O/S 13 14 System Calls Programming interface to the services provided by the OS Typically written in a high-level language (C or C++) Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use Ease of programming portability Three most common APIs are Win32 API for Windows, POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the Java virtual machine (JVM) 15 System Calls! All programs needing resources must use system calls user space kernel space User programs Library functions & programs... fputs, getchar, ls, pwd, more...... fork, open, read System calls rm, chmod, kill... Operating system the middleman s counter " system calls are the only entry points into the kernel and system " most UNIX commands are actually library functions and utility programs (e.g., shell interpreter) built on top of the system calls " however, the distinction between library functions and system calls is not critical to the programmer, only to the O/S designer 16 Example of System Calls System call sequence to copy the contents of one file to another file 17 System Call Implementation Typically, a number associated with each system call System-call interface maintains a table indexed according to these numbers The system call interface invokes intended system call in OS kernel and returns status of the system call and any return values The caller need know nothing about how the system call is implemented Just needs to obey API and understand what OS will do as a result call Most details of OS interface hidden from programmer by API Managed by run-time support library (set of functions built into libraries included with compiler) 18

Dual-Mode Operation Dual-mode operation allows OS to protect itself and other system components User mode and kernel mode Mode bit provided by hardware Provides ability to distinguish when system is running user code or kernel code Protects OS from errant users, and errant users from each other Some instructions designated as privileged, only executable in kernel mode System call changes mode to kernel, return from call resets it to user Transition from User to Kernel Mode How to prevent user program getting stuck in an infinite loop / process hogging resources # Timer: Set interrupt after specific period (1ms to 1sec) Operating system decrements counter When counter zero generate an interrupt Set up before scheduling process to regain control or terminate program that exceeds allotted time 19 20 Standard C Library Example Solaris System Call Tracing C program invoking printf() library call, which calls write() system call 21 22 Virtual Machines Virtual Machines A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware A virtual machine provides an interface identical to the underlying bare hardware The virtual machine creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory 23 24

Virtual Machines (Cont.) Virtual Machines (Cont.) The resources of the physical computer are shared to create the virtual machines CPU scheduling can create the appearance that users have their own processor Spooling and a file system can provide virtual card readers and virtual line printers A normal user time-sharing terminal serves as the virtual machine operator s console Non-virtual Machine Virtual Machine (a) Nonvirtual machine (b) Virtual machine 25 26 Virtual Machines (Cont.) VMware Architecture The virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines. This isolation, however, permits no direct sharing of resources. A virtual-machine system is a perfect vehicle for operating-systems research and development. System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation. The virtual machine concept is difficult to implement due to the effort required to provide an exact duplicate to the underlying machine 27 28 Multilevel Feedback Queues Estimating CPU bursts Project Discussion System Calls Virtual Machines Summary Next Lecture: Process Synchronization Hmm.. Acknowledgements Operating Systems Concepts book and supplementary material by A. Silberschatz, P. Galvin and G. Gagne Operating Systems: Internals and Design Principles book and supplementary material by W. Stallings Modern Operating Systems book and supplementary material by A. Tanenbaum R. Doursat and M. Yuksel from UNR 29 30