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

Similar documents
Multiprocessor and Real-Time Scheduling. Chapter 10

ECE519 Advanced Operating Systems

Multiprocessor and Real- Time Scheduling. Chapter 10

Multiprocessor scheduling

Module 20: Multi-core Computing Multi-processor Scheduling Lecture 39: Multi-processor Scheduling. The Lecture Contains: User Control.

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

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

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

CS418 Operating Systems

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)

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.

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

Chapter 5: CPU Scheduling

SMD149 - Operating Systems - Multiprocessing

Overview. SMD149 - Operating Systems - Multiprocessing. Multiprocessing architecture. Introduction SISD. Flynn s taxonomy

Introduction II. Overview

Multiprocessors and Thread-Level Parallelism. Department of Electrical & Electronics Engineering, Amrita School of Engineering

Multiple Processor Systems. Lecture 15 Multiple Processor Systems. Multiprocessor Hardware (1) Multiprocessors. Multiprocessor Hardware (2)

Multi-Processor / Parallel Processing

Parallel Processors. The dream of computer architects since 1950s: replicate processors to add performance vs. design a faster processor

CS370 Operating Systems

Announcements. Program #1. Reading. Due 2/15 at 5:00 pm. Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed)

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

LECTURE 3:CPU SCHEDULING

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

06-Dec-17. Credits:4. Notes by Pritee Parwekar,ANITS 06-Dec-17 1

PROCESS SCHEDULING II. CS124 Operating Systems Fall , Lecture 13

CS370 Operating Systems

Serial. Parallel. CIT 668: System Architecture 2/14/2011. Topics. Serial and Parallel Computation. Parallel Computing

Non-uniform memory access machine or (NUMA) is a system where the memory access time to any region of memory is not the same for all processors.

CPU Scheduling: Objectives

Task Scheduling of Real- Time Media Processing with Hardware-Assisted Virtualization Heikki Holopainen

CS 590: High Performance Computing. Parallel Computer Architectures. Lab 1 Starts Today. Already posted on Canvas (under Assignment) Let s look at it

CSCI-GA Operating Systems Lecture 3: Processes and Threads -Part 2 Scheduling Hubertus Franke

Computer and Information Sciences College / Computer Science Department CS 207 D. Computer Architecture. Lecture 9: Multiprocessors

Computer Systems Architecture

W4118: advanced scheduling

CSCI 4717 Computer Architecture

Course Syllabus. Operating Systems

10 Parallel Organizations: Multiprocessor / Multicore / Multicomputer Systems

Multiple Issue and Static Scheduling. Multiple Issue. MSc Informatics Eng. Beyond Instruction-Level Parallelism

Comp 310 Computer Systems and Organization

Computer Systems Architecture

ARCHITECTURAL CLASSIFICATION. Mariam A. Salih

Example: CPU-bound process that would run for 100 quanta continuously 1, 2, 4, 8, 16, 32, 64 (only 37 required for last run) Needs only 7 swaps

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

Introduction. CS3026 Operating Systems Lecture 01

EECS 750: Advanced Operating Systems. 01/29 /2014 Heechul Yun

QUESTION BANK UNIT I

Computer Organization. Chapter 16

CEC 450 Real-Time Systems

Operating Systems. Introduction & Overview. Outline for today s lecture. Administrivia. ITS 225: Operating Systems. Lecture 1

Operating System Review Part

Chapter 4 Threads, SMP, and

Process management. Scheduling

Chapter 5: CPU Scheduling

CS6401- Operating System QUESTION BANK UNIT-I

Multiprocessor Systems. COMP s1

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

MULTIPROCESSORS AND THREAD-LEVEL. B649 Parallel Architectures and Programming

MULTIPROCESSORS AND THREAD-LEVEL PARALLELISM. B649 Parallel Architectures and Programming

Scheduling Mar. 19, 2018

Process Scheduling. Copyright : University of Illinois CS 241 Staff

Practice Exercises 305

Scheduling. Scheduling 1/51

CS 326: Operating Systems. CPU Scheduling. Lecture 6

Scheduling. Scheduling 1/51

Organisasi Sistem Komputer

Operating Systems. Computer Science & Information Technology (CS) Rank under AIR 100

Scheduling in the Supermarket

Chapter 18 Parallel Processing

Computer parallelism Flynn s categories

Operating Systems. Scheduling

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Lecture 9: MIMD Architectures

Last Class: Processes

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

THREAD LEVEL PARALLELISM

CS307: Operating Systems

High level scheduling: Medium level scheduling: Low level scheduling. Scheduling 0 : Levels

Parallel Architectures

Operating Systems. Process scheduling. Thomas Ropars.

Operating Systems, Fall Lecture 9, Tiina Niklander 1

8: Scheduling. Scheduling. Mark Handley

Parallel Processing. Computer Architecture. Computer Architecture. Outline. Multiple Processor Organization

Online Course Evaluation. What we will do in the last week?

Introduction to parallel computers and parallel programming. Introduction to parallel computersand parallel programming p. 1

Parallel Processors. Session 1 Introduction

WHY PARALLEL PROCESSING? (CE-401)

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

Multiprocessor System. Multiprocessor Systems. Bus Based UMA. Types of Multiprocessors (MPs) Cache Consistency. Bus Based UMA. Chapter 8, 8.

Introduction to Operating System

Scheduling. Today. Next Time Process interaction & communication

Principles of Operating Systems CS 446/646

Comp. Org II, Spring

Lecture 7: Parallel Processing

CS3733: Operating Systems

Parallel Processing & Multicore computers

Announcement. Exercise #2 will be out today. Due date is next Monday

Multiprocessors - Flynn s Taxonomy (1966)

Transcription:

Lecture Topics Today: Advanced Scheduling (Stallings, chapter 10.1-10.4) Next: Deadlock (Stallings, chapter 6.1-6.6) 1 Announcements Exam #2 returned today Self-Study Exercise #10 Project #8 (due 11/16) Project #9 (due 11/30) 2

Case Study: MSU HPCC MSU's High Performance Computing Center has facilities for compute-intensive programs Users submit batch jobs (shell scripts), must declare upper bound on resources such as CPU time and memory usage System schedules the jobs onto the resources 3 Overview: MSU HPCC Torque: manages resources, interacts with users Moab: schedules jobs onto resources Job which exceeds stated limits is terminated 4

Overview: MSU HPCC From the HPCC website: The smaller the job, the more opportunities there are for resources to become available. The system tries to schedule large jobs (number of CPUs and memory) and then tries to fit the smaller jobs in around them. Given two equivalent jobs, the scheduler will give more priority to the user who has used the system less in the last week. 5 Example Script: MSU HPCC #!/bin/bash -login ### walltime - how long you expect the job to run #PBS -l walltime=00:01:00 ### nodes:ppn - how many nodes & cores per node (ppn) that you require #PBS -l nodes=5:ppn=1 ### mem: amount of memory that the job will need #PBS -l mem=2gb ### call your executable mpirun -np 5 <exectuable> 6

Multiprocessor Systems On-going theme in computing: exploit parallelism to improve performance Instruction-level parallelism: concurrent execution of individual instructions (pipelined and superscalar architectures) Task-level parallelism: concurrent execution of processes or threads 7 Flynn's Taxonomy (1966) SISD: single instruction stream, single data stream SIMD: single instruction stream, multiple data streams MISD: multiple instruction streams, single data stream MIMD: multiple instruction streams, multiple data streams 8

9 Multiprocessor Systems Multiprocessor systems support execution of more than one task simultaneously (more than one processor available) Loosely coupled multiprocessor (cluster): multiple standalone machines interconnected by a high-speed network Tightly coupled multiprocessor: multiple processors interconnected at the bus level 10

Loosely Coupled System (Cluster) Collection of interconnected autonomous computers (each computer has its own processor and memory) Each computer is called a node Cluster as a whole can be viewed as a machine with multiple processors High-speed interconnection is critical (communication via message passing) 11 Loosely Coupled System (Cluster) 12

Tightly Coupled System Collection of processors, each of which has its own Level 1 cache Processors share RAM (and perhaps some levels of cache) Interconnected at the bus level Single operating system controls all processors and peripherals 13 Tightly Coupled System 14

Variations UMA (Uniform Memory Access): access time to memory is the same for all processors NUMA (Non-Uniform Memory Access): access time to memory may differ (access to local memory is faster than to remote memory) SMP (Symmetric Multiprocessor): another term for UMA processor 15 UMA architecture 16

NUMA architecture 17 Multicore Systems Multiple processors (cores) on the same die Tightly-coupled (shared memory) systems (can be either UMA or NUMA) Example: Intel Core i7 split Level 1 cache (per core) Level 2 cache (per core) Level 3 cache (shared) RAM (shared) 18

Example: Intel Core i7 19 Granularity of Parallelism Another viewpoint: what is the frequency of synchronization of concurrent processes? Independent processes (no synchronization): benefit from a multiprocessor system since additional processors are available Cooperating processes: frequency of synchronization varies (table) 20

Granularity of Parallelism Granularity Description Synchronization interval (in instructions) Independent Multiple unrelated processes Not applicable Very Coarse Coarse Medium Distributed processing across network Concurrent processes in multiprogramming system Multitasking within single application 2,000 1,000,000 200 2,000 20-200 Fine Instruction-level parallelism < 20 21 Granularity of Parallelism Coarse: concurrent processes, can run on uniprocessor system or multiprocessor system Medium: multiple threads within a single application 22

Multiprocessor Scheduling Three main issues: assignment of processes to processors individual processors multiprogrammed or not process dispatch Degree of granularity of applications and number of processors available influence details of approach used 23 Assignment of Processes to Processors Static assignment: a process is permanently assigned to a specific processor (queue of processes for each processor) simple, low overhead one processor may sit idle while others are busy Dynamic assignment: a process may run on different processors (global queue or load balancing) 24

Assignment of Processes to Processors Related issue: who does the assignment? Master / slave approach: one processor runs kernel, other processors run user processes Peer approach: kernel can run on any processor; each processor schedules itself (requires additional overhead to control access to shared resources) 25 Multiprogramming on Processors If static assignment is used, should the processor be multiprogrammed? Independent: yes Coarse: yes Medium: maybe Applications with multiple threads may have poor performance unless all threads are running simultaneously 26

Process Dispatch Uniprocessor system: important to make good choice to keep processor busy, so sophisticated algorithm used Multiprocessor system: more CPU cycles available, so less important to make good choice simpler algorithm with less overhead is sufficient 27 Process and Thread Scheduling Process scheduling: most multiprocessor systems use a common pool of processors and dynamically allocate processes to processors Thread scheduling: to exploit parallelism in a threaded application, the threads must be executing simultaneously; scheduling and processor assignment can have a large impact 28

Approaches to Thread Scheduling Load sharing: one queue of threads in Ready state, each processor selects from that queue Gang scheduling: set of related threads scheduled onto a specific set of processors Dedicated processor assignment: each thread scheduled onto a specific processor Dynamic scheduling: number of threads in a process can change during execution 29 Multicore Thread Scheduling Typical approach: same as other multiprocessor environments Does not recognize that multiple levels of cache in multicore environment imposes different constraints Threads which share data should be scheduled based on cache organization (number of levels, how shared) 30

Real-Time Systems Tasks or processes attempt to control or react to events that take place in the outside world These events occur in real time and tasks must be able to keep up with them Correctness of the system depends not only on the logical result of the computation but also on the time at which the results are produced 31 Examples of Real-Time Systems Control of laboratory experiments Process control in industrial plants Robotics Air traffic control Telecommunications Military command and control systems 32

Characteristics of Real-Time OS Determinism: focus is on how long it takes the OS to acknowledge an interrupt Operations must be performed at fixed, predetermined times or within predetermined time intervals Concerned with how long the operating system delays before acknowledging an interrupt and that there is sufficient capacity to handle all of the requests within the required time 33 Characteristics of Real-Time OS Responsiveness: focus is on how long it takes the operating system to service an interrupt (after acknowledging it) Includes amount of time to initially handle the interrupt and start the ISR (longer if process switch is required) Includes amount of time to run the interrupt service routine Nested interrupt handling may cause delays 34

Characteristics of Real-Time OS User control User given finer-grain control over priority of processes Reliability Degradation of performance may have catastrophic consequences Fail-soft operation Ability of a system to fail in such a way as to preserve as much capability and data as possible 35 Features of Real-Time Operating Systems Ability to respond to external interrupts quickly Preemptive scheduling based on priority Fast process (or thread) switch Minimization of intervals during which interrupts are disabled Multitasking with interprocess communication tools such as semaphores and signals 36

UNIX SVR4 Scheduling Highest preference to real-time processes Next highest preference to kernel-mode processes Lowest preference to other user-mode processes 37 Linux Scheduling Unit of execution is the thread By default, OS uses load sharing to maximize processor utilization User can influence scheduling decisions (utility programs, thread library functions) Recent releases of Linux (2.6 and up) support both real-time scheduling and normal scheduling 38

Linux Scheduling Goals Algorithms in scheduler to run quickly, regardless of number of threads or processors Perfect scalability with respect to number of processors Improved affinity between threads and processors (keep thread on same processor whenever possible) 39 Linux Scheduling Goals Provide good interactive service, even when system is heavily loaded Provide fairness (no thread should be starved, no thread should receive too many CPU cycles) Optimize for common case (only a few runnable threads), but scale up to handle heavy workloads 40

Scheduling Policies Real-time policies SCHED_FIFO SCHED_RR Normal policies SCHED_OTHER SCHED_BATCH SCHED_IDLE 41 Real-Time Scheduling: SCHED_FIFO Static priority scheduling: each thread given a priority between 1 and 99 (lowest priority) Scheduler scans priority queues, selects thread with highest priority (FCFS, if more than one thread with same priority) Thread runs until it blocks, exits, or is preempted by a higher priority thread 42

Real-Time Scheduling: SCHED_RR Variation on SCHED_FIFO: each thread given a priority between 1 and 99 Scheduler scans priority queues, selects thread with highest priority (FCFS, if more than one thread with same priority) Thread runs until it blocks, exits, uses up its time slice, or is preempted by a higher priority thread 43 Normal Scheduling: SCHED_OTHER Default is SCHED_OTHER: each thread given a static priority between 100 and 139 (120 by default) Scheduler calculates dynamic priority based on static priority and execution behavior A non-real-time thread is only selected if there are no real-time threads in the Ready state 44

Linux Scheduling: the O(1) scheduler Each processor has its own scheduling data structures Two data structures: set of active queues, set of expired queues Separate queue for each priority level (bitmap indicates which queues are not empty) 45 Linux Scheduling: the O(1) scheduler 46

Linux Scheduling: the O(1) scheduler Scheduler selects thread at front of highest priority queue which is not empty (constant time using bitmap) When all active queues are empty, flip-flop the active queues and the expired queues by changing two pointers (the expired queues become the active queues) 47 Normal Threads Thread preempted: returns to front of active queue (keeps remaining time slice) Thread uses full time slice: placed at back of expired queue (given new time slice) Priority recalculated when thread placed in queue (based on static priority and run-time behavior) Time slice based on priority 48

Real-Time Threads Thread preempted: returns to front of active queue (keeps remaining time slice) Thread uses full time slice: placed at back of active queue (given new time slice) Real-time threads are never moved to the set of expired queues Priority never changes Time slice based on priority 49 Priority Calculations Priority of normal thread recalculated whenever it is placed in a queue Based on how long it is blocked vs. how long it is runnable (I/O bound threads will be blocked for long periods of time) Favors I/O bound threads, but doesn't penalize threads which have occasional long CPU bursts 50

Linux Scheduling: the CFS scheduler The O(1) scheduler has become bloated (complex code for heuristics) Recent alternative: Completely Fair Scheduler (CFS) Uses red-black tree instead of run queues Identifying next process is O(1), but insertion back into the red-black tree is O(log N) 51 Linux Scheduling: the CFS scheduler 52