Operating Systems: Introduction n 1. Historical Development n 2. The OS as a Resource Manager n 3. Definitions n 4. The Process.

Slides:



Advertisements
Similar presentations
Topic : Process Management Lecture By: Rupinder Kaur Lecturer IT, SRS Govt. Polytechnic College for Girls,Ludhiana.
Advertisements

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.
 Basic Concepts  Scheduling Criteria  Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Operating Systems Chapter 6
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Operating Systems CPU Scheduling. Agenda for Today What is Scheduler and its types Short-term scheduler Dispatcher Reasons for invoking scheduler Optimization.
Chapter 3: CPU Scheduling
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
Scheduling in Batch Systems
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 5-CPU Scheduling
02/11/2004CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Chapter 6: CPU Scheduling
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
CS212: OPERATING SYSTEM Lecture 3: Process Scheduling 1.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
ICS Principles of Operating Systems Lecture 5 - CPU Scheduling Prof. Nalini Venkatasubramanian
Scheduling. Alternating Sequence of CPU And I/O Bursts.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
Alternating Sequence of CPU And I/O Bursts. Histogram of CPU-burst Times.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
Process A program in execution. But, What does it mean to be “in execution”?
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
Process Program (Passive Entity) is a sequence of instructions, written to perform a specified task on a computer. A computer requires programs to function,
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 5 CPU Scheduling Slide 1 Chapter 5 CPU Scheduling.
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Introduction to Operating System Created by : Zahid Javed CPU Scheduling Fifth Lecture.
1 Uniprocessor Scheduling Chapter 3. 2 Alternating Sequence of CPU And I/O Bursts.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
Basic Concepts Maximum CPU utilization obtained with multiprogramming
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
CPU SCHEDULING.
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Operating Systems CPU Scheduling.
CPU Scheduling Basic Concepts Scheduling Criteria
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 5: CPU Scheduling
Operating System Concepts
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling.
CPU Scheduling: Basic Concepts
Module 5: CPU Scheduling
Presentation transcript:

Operating Systems: Introduction n 1. Historical Development n 2. The OS as a Resource Manager n 3. Definitions n 4. The Process

The OS as a Resource Manager n Resources –4 functions n Keep track of resource n Enforce policy - n Allocate n Reclaim

The OS as a Resource Manager n Memory management –Keep track –If multiprogramming: –Allocate –Reclaim (p i relinquishes it or terminates)

The OS as a Resource Manager n Processor management –Keep track of –Scheduling: –Allocate : –Reclaim : p i relinquishes P, terminates, exceeds TS

n Device management –Keep track of devices, channels, control units –Efficient allocation policy –Allocate : –Reclaim : Normally automatic termination The OS as a Resource Manager

n Information management –Keep track : Location, use, status ( ) –Who gets use of resources, enforce protection, provide accessing routines –Allocate (“Open file”) –Deallocate (“Close file”) The OS as a Resource Manager

Bare machine Level 1 Processor management lower module (P,V), Process Scheduler Level 2 Memory management Level 3 Processor management upper module (messages, create- destroy process) Level 4 Device management (I/O traffic control) Info management (File system) Level 5 Kernel

I/O process User-created process I/O process working with User process 3 SPOOLing Process 1Process 2 Process 3 Supervisor process (Job scheduler) Jobs Hierarchical OS Structure Kernel (Layer 0) Layer 1 Layer 2

Definitions n Operating System (OS) : –Software governing control of resources –( ) –Interface n Processor : Hardware which interprets and executes instructions n Process (task) : n Job : Set of modules req’d to perform some task

Definitions n Multiprogramming : n Privileged instruction : –Instruction available only to –Executed in supervisor (executive) state as opposed to problem (user) state. n Interrupt : –Mechanism forcing processor to take notice of event

I.4 The Process n Process (p i ) : A program in a state of execution n Life : (Higher level view) –1. Run : p i <-P –2. Wait : For event –3. Ready : RUN READYWAIT p i P Wait for I/O completion I/O complete

Life of a Process n Lower level view : RUN WAITREADYHOLD SUBMIT COMPLETE

Processor Management and Scheduling Processor Management and Scheduling n 1. Introduction n 2. Basic Concepts n 3. Processor Scheduling Algorithms

Introduction Introduction n Given : 2 jobs, A and B. n Each executes for 1 sec, waits for 1 sec n Repeat this for 60 cycles [ 2 min ] –1. Let’s run A, then B A: B: 2 min Elapsed Time : 4 minCompute Time : 2 min CPU Utilization : 2/4 = 50%

–2. Now multi-program A and B A: B: Introduction Elapsed Time : 2+ min Compute Time : 2 min CPU Utilization : 2/2+ = ~100% –Compare to 1 : A finishes at same time, – Compare to 1 : A finishes at same time, B in half the time. B in half the time.

n So now we have multiprogramming: –N jobs in memory –Job i P –When i waits for I/O, j P n Overlap CPU and I/O to keep P busy –Benefits : Increased CPU utilization and higher throughput. n Throughput : Work done in given period. –E.g. 10 jobs per hour. Introduction

Basic Concepts Basic Concepts n Process : a program in a state of execution. –E.g. Batch job, transaction (in T-S system) –Also called : job, program, task, activity. n Process behavior : p i alternate between execution(CPU burst) & I/O(I/O burst). –Generally begins and ends with CPU bursts.

Basic Concepts n p i change state as they execute –READY, RUN, WAIT, HOLD. n Process Control Block (PCB) –Process is represented internally by its PCB –Active representation of passive entity, the PGM n “The only tangible part of a process”

–PCB n Process id n Current State n Priority n Other CPU Scheduling info n State info : PC (address of NI to be executed) register, cc contents n Memory management info : base-bounds registers, page tables n Accounting info : amount of CPU time, account # n I/O status info : I/O requests pending, I/O devices allocated, list of open files n Pointer to list of all p i in same state n etc.

Basic Concepts n Scheduling queues –Ready queue : List of processes (PCBs) in ready state (awaiting assignment of P) –Device queue : List of p i waiting on this device –I/O queue : p i waiting for I/O (once served, p i moves to Ready queue). Head Tail PCB i Registers PCB jPCB n Registers Queue header...

Basic Concepts n Schedulers : –Job (long-term) scheduler : n Selects job from spool queue to enter system, loads it into memory –Processor (CPU, short-term) scheduler : n Selects ready p i and dispatches (assigns P to) it

–Difference : How often they execute –Job scheduler n Infrequently once steady state is reached n Controls degree of multiprogramming (number of p i in memory) –Processor scheduler n Must select new p i very frequently (every 10 ms) n FAST or much of the processor time is spent in scheduling !

Basic Concepts n Dispatcher –Assigns P to p i selected by Processor scheduler –Loads p i ’s registers –Changes to user mode –Jumps to proper address [ to (re)start it ]

Processor Scheduling Algorithms Processor Scheduling Algorithms n Problem : Which p i in Ready queue gets P? n Performance Criteria (Comparing algorithms): –Throughput : Work done in given period. –CPU utilization : P busy time / Total elapsed time n Want it as busy as possible (40-90%). –Turnaround time : Interval between submission to completion of job (Batch OS). –Wait time : Time spent by p i in Ready queue. –Response time : Interval from submission until response produced (Interactive system).

Processor Scheduling Algorithms n Let’s optimize as follows : –Maximize CPU utilization, throughput –Minimize turnaround time (TT), wait, response time. –Operationally : n Optimize average or max or min n e.g. Minimize the max response time Minimize variance in response time.

Common Scheduling Algorithms n (a) First Come First Served (FCFS) n (b) Shortest Job First (SJF) n (c) Priority –Preemptive vs Non-preemptive n (d) Round Robin n (e) Multilevel Queues

Scheduling Algorithms n First Come First Served (FCFS) –Implementation : FIFO queue –p j enters ready q : –p i dispatched : –Consider :Job CPU burst A 24 B 3 C 3 pipi pkpk pjpj pkpk pjpj... RQ RQ

n FCFS –Suppose jobs arrive in order A, B, C and are served FCFS. n TT : For A = 24, For B = 27, For C = 30 n Avg TT : ( ) / 3 = 27 –Now, suppose they arrive in order B, C, A n Avg TT : ( ) / 3 = 13 ABC ABC

Scheduling Algorithms n Shortest Job First (SJF) –Associates with job the length of its next CPU burst –Example of priority scheduling (job with shortest next CPU burst gets highest priority) –Consider :Job CPU burst A 6 B 3 C 8 D 7

n SJF n Avg TT : ( ) / 4 = 13 –This algorithm can be proved optimal n Gives min avg wait time for given set of jobs –Problem : Length of next CPU burst n Batch jobs : Time limit supplied by user n Processes : Can’t know [but can predict] B[3]D[7]C[8]A[6]

Scheduling Algorithms n Priority Scheduling –Can be assigned : who is paying, type of work –Can be computed : n Time limits, memory req., ratio avg I/O burst to CPU burst, number of open files –Major problem : Starvation n Low priority Ready p i can wait indefinitely for CPU n Eventually, load lightens and job gets run, or system crashes and job is lost –Remedy n Aging : Increase priority of low priority job over time

Scheduling algorithms n Round Robin (RR) –Designed for TS systems n Given defined TS ( ms). –CPU scheduler traverses Ready queue, selects p i to be dispatched for interval  TS –Implementation : n Ready queue = FIFO queue n CPU scheduler picks 1st job in Ready queue n Sets timer to interrupt after 1 TS n Dispatches process

n Multilevel Queue –Good when jobs easily classified into groups n e.g. foreground (FG - interactive) and background (BG - batch) –In a multilevel scheduling algorithm : n Ready queue partitioned into separate queues n Each p i assigned permanently to one queue –Due to memory size, job type, … n Each queue has its own scheduling algorithm –FG : RR, BG : FCFS n Must have scheduling between the queues –e.g. Fixed priority preemptive (such as FG > BG) Scheduling algorithms