CS418 Operating Systems

Similar documents
CPU Scheduling Algorithms

Chapter 6: CPU Scheduling

Scheduling of processes

Chapter 5: CPU Scheduling

CS370 Operating Systems

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

LECTURE 3:CPU SCHEDULING

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter

Preview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System

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

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

8: Scheduling. Scheduling. Mark Handley

Today s class. Scheduling. Informationsteknologi. Tuesday, October 9, 2007 Computer Systems/Operating Systems - Class 14 1

Ch 4 : CPU scheduling

CS370 Operating Systems

1.1 CPU I/O Burst Cycle

Properties of Processes

Uniprocessor Scheduling. Aim of Scheduling

Uniprocessor Scheduling. Aim of Scheduling. Types of Scheduling. Long-Term Scheduling. Chapter 9. Response time Throughput Processor efficiency

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

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

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

COSC243 Part 2: Operating Systems

CHAPTER 2: PROCESS MANAGEMENT

CS370 Operating Systems

CPU Scheduling. Rab Nawaz Jadoon. Assistant Professor DCS. Pakistan. COMSATS, Lahore. Department of Computer Science

Lecture Topics. Announcements. Today: Advanced Scheduling (Stallings, chapter ) Next: Deadlock (Stallings, chapter

CPU Scheduling: Objectives

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

Chapter 5: CPU Scheduling

Chapter 5 CPU scheduling

So far. Next: scheduling next process from Wait to Run. 1/31/08 CSE 30341: Operating Systems Principles

Chapter 9 Uniprocessor Scheduling

Operating Systems. Lecture Process Scheduling. Golestan University. Hossein Momeni

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

Last Class: Processes

Uniprocessor Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Three level scheduling

CS307: Operating Systems

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

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

Operating Systems. Instructor: Dmitri A. Gusev. Spring Lecture 16, April 17, CSC : Introduction to Computer Science

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling

CPU Scheduling: Part I ( 5, SGG) Operating Systems. Autumn CS4023

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

Uniprocessor Scheduling. Chapter 9

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

Operating Systems Unit 3

Course Syllabus. Operating Systems

Uniprocessor Scheduling

Chapter 5: CPU Scheduling

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

Scheduling. Scheduling. Scheduling. Scheduling Criteria. Priorities. Scheduling

Chapter 6: CPU Scheduling

UNIT 3. PROCESS MANAGEMENT

Subject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date:

Operating System Concepts Ch. 5: Scheduling

CS3733: Operating Systems

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

Practice Exercises 305

CPU scheduling. Alternating sequence of CPU and I/O bursts. P a g e 31

Chapter 9. Uniprocessor Scheduling

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )

Operating Systems. Scheduling

Announcements/Reminders

CPU Scheduling. Schedulers. CPSC 313: Intro to Computer Systems. Intro to Scheduling. Schedulers in the OS

Chapter 5: Process Scheduling

Announcements. 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.

CISC 7310X. C05: CPU Scheduling. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/1/2018 CUNY Brooklyn College

Frequently asked questions from the previous class survey

Operating Systems CS 323 Ms. Ines Abbes

CSE 4/521 Introduction to Operating Systems

Unit 3 : Process Management

by Maria Lima Term Paper for Professor Barrymore Warren Mercy College Division of Mathematics and Computer Information Science

Lecture 2 Process Management

Department of Computer applications. [Part I: Medium Answer Type Questions]

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems, 3rd edition. Uses content with permission from Assoc. Prof. Florin Fortis, PhD

CPU Scheduling (1) CPU Scheduling (Topic 3) CPU Scheduling (2) CPU Scheduling (3) Resources fall into two classes:

Scheduling Bits & Pieces

SMD149 - Operating Systems

TDIU25: Operating Systems II. Processes, Threads and Scheduling

OPERATING SYSTEMS: Lesson 4: Process Scheduling

Scheduling. The Basics

Advanced Operating Systems (CS 202) Scheduling (1)

Comp 310 Computer Systems and Organization

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

Scheduling - Overview

CS 326: Operating Systems. CPU Scheduling. Lecture 6

Processes and Threads

Assignment 3 (Due date: Thursday, 10/15/2009, in class) Part One: Provide brief answers to the following Chapter Exercises questions:

Process Scheduling. Copyright : University of Illinois CS 241 Staff

Job Scheduling. CS170 Fall 2018

Processes and Threads. Processes: Review

UNIT 2 PROCESSES 2.0 INTRODUCTION

Scheduling. Scheduling 1/51

Interactive Scheduling

Two Level Scheduling. Interactive Scheduling. Our Earlier Example. Round Robin Scheduling. Round Robin Schedule. Round Robin Schedule

Scheduling in the Supermarket

OPERATING SYSTEMS. UNIT II Sections A, B & D. An operating system executes a variety of programs:

CSCE Operating Systems Scheduling. Qiang Zeng, Ph.D. Fall 2018

OS Assignment II. The process of executing multiple threads simultaneously is known as multithreading.

Transcription:

CS418 Operating Systems Lecture 9 Processor Management, part 1 Textbook: Operating Systems by William Stallings 1

1. Basic Concepts Processor is also called CPU (Central Processing Unit). Process an executable program, also called task, activity. Job a unit of work that is submitted by the user. A job is composed a set of processes. Processor management for a single-user system is easy: set a job either idle or busy. Multiprogramming many users with many jobs on the same system. Processor management can be further divided into two parts: Job scheduler which is at a high-level and Process scheduler which is at a low-level. We will mainly focus on process scheduler.

2. Process Scheduler Process scheduler assigns the CPU to execute the processes of those jobs placed in the READY queue by the Job Scheduler. There are 2 classes of jobs: I/O-oriented and CPU-oriented. Each process in the system is represented by a data structure called Process Control Block (PCB).

PCBs are usually linked into queues.

What makes a good scheduling policy? 1. Maximize throughput: running as many jobs as possible in a fixed period of time. /* running short jobs or jobs with no interrupts */ 2. Minimize response time: satisfying interactive requests. /* running only interactive jobs, letting batch jobs wait */ 3. Minimize turnaround time: moving entire jobs in and out of the system quickly. /* running batch jobs first */ 4. Minimize waiting time: moving jobs out of READY queue as quickly as possible. /* reducing the number of users */ 5. Maximize CPU efficiency: keeping CPU busy 100% of the time. /* running only CPU-bound jobs */ 6. Ensure fairness for all jobs: giving each job an equal amount of CPU and I/O time. /* disregarding priority */ Preemptive scheduling policy: A scheduling strategy that interrupts the processing of a job and transfers the CPU to another job. Nonpreemptive scheduling policy: A scheduling strategy that does not allow external interrupts.

3. Scheduling Algorithms First Come First Serve (nonpreemptive) 1. The earlier the jobs arrive, the sooner they are served. 2. No WAIT queue is needed (as there is no interrupt).

Shortest Job Next (nonpreemptive) 1. Does not work in an interactive system. 2. SJN is optimal when all the jobs are available at the same time and CPU times are estimated accurately.

Priority Scheduling (nonpreemptive) 1. One of the most common methods used in batch systems. 2. High-priority jobs will be run first, tie is broken by arriving time. 3. It is usually hard to set priorities. Non-technical factor: position, fee. Technical factor: Memory requirements, # of peripheral devices, total CPU time, time in system (aging).

Shortest Remaining Time (preemptive) 1. CPU time is divided into small fragments. 2. SRT will try to finish the job closest to completion. 3. Not suitable for interactive systems. 4. Context switching: When a job is preempted, all its running information must be kept.

Round Robin (preemptive) 1. CPU time is divided into small fragments (slices). 2. Suitable for interactive systems. 3. First come first serve. 4. Slices too large FCFS. 5. Slices too small too much context switching.

Highest Response Ratio Next (Nonpreemptive) 1. Objective: run jobs to minimize (turnaround time/service time)- ratio. 2. As both turnaround time and service time cannot be known in advance in most situations, we approximate them based on past history (especially when the job takes several slices to run). 3. Approximate ratio R = (waiting time+expected service time) expected service time. 4. Aging a job has a long waiting time it s ratio R gets bigger it will get serviced earlier.

Multi-level Queues It is a combination of some of the previous algorithms. Example: in a system which handles both batch and interactive jobs, we have a background queue for the first one and a foreground queue for the latter ones. How do we switch queues? How fair is this? 1. No movement between queues. Good for high-priority jobs. High-priority queue empties first. 2. With movement between queues. Feedback Scheduling: Divided CPU time into slices and once a job is in system its priority is disregarded it can be preempted and moved to the end of the next lower queue. This is the fairest if the jobs are divided into CPU-bound and I/O-bound. Good for I/O-bound jobs. 3. Movement between queues with variable time slices. Highest-priority queue get time slices t. Second highestpriority queue get time slices 2t.... A job in system can be preempted and moved to the end of the next lower queue. Good for CPU-bound jobs. It also handles aging well.

4. Threads Multithreading some modern operating systems support multiple threads of execution within a single process. In a multithread environment, a process is defined as the unit of protection and the unit of resource allocation. Each process contains a virtual address space that holds the information related to it. Each process contains protected access to processors, other processes, files and I/O devices. Benefits of using threads Performance: it takes less time to create a new thread than to create a new process.

Given a process, there might be several threads, each with the following: A thread execution state A saved thread context when not running An execution stack Some pre-thread static storage for local variables Access to the memory and resources of its process (threads in one process all have the same access) Thread states: Spawn Block (wait) Unblock (ready) Finish

5. Symmetric Multiprocessing Flynn proposed the following categories of computer systems in 1972. Single Instruction Single Data (SISD) stream. Example, a PC runs MS-DOS. Single Instruction Multiple Data (SIMD). Example, an array of processors doing numeric computations. Multiple Instruction Single Data (MISD) stream. Never been implemented. Multiple Instruction Multiple Data (MIMD) stream. Most commonly used in practice. In a symmetric multiprocessor the system kernel can execute on any processor. Clusters (Coarse Grained Multicomputers, Coarse Grained Multiprocessors) received a lot of attention since 1990s. Examples: PVM (Parallel Virtual Machine) and MPI (Massive Parallel Interface).