Scheduling Example 3 (1) Assume: FIFO Job Scheduling 100 K Main Memory Processor Sharing Process Scheduling (Cont…)

Slides:



Advertisements
Similar presentations
Chapter 3 Process Description and Control
Advertisements

Topic : Process Management Lecture By: Rupinder Kaur Lecturer IT, SRS Govt. Polytechnic College for Girls,Ludhiana.
CS 149: Operating Systems February 3 Class Meeting
CS4315A. Berrached:CMS:UHD1 CPU Scheduling Chapter 7.
Scheduling Algorithms
A. Frank - P. Weisberg Operating Systems Process Scheduling and Switching.
Chapter 3: CPU Scheduling
Process Description and Control
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
1 Process Description and Control Chapter 3. 2 Process Management—Fundamental task of an OS The OS is responsible for: Allocation of resources to processes.
1 Multilevel Feedback Queue Scheduling Another way to put a preference on short-lived processes –Penalize processes that have been running longer. Preemptive.
CSSE Operating Systems
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Process Description and Control A process is sometimes called a task, it is a program in execution.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Process Description and Control
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Operating System 3 PROCESS DESCRIPTION AND CONTROL.
CPU Scheduling Chapter 6 Chapter 6.
Chapter 6: CPU Scheduling
Processor Management Introduction
Chapter 4 Processor Management
Chapter 6 CPU SCHEDULING.
Chapter 4 Processor Management
Chapter Four : Processor Management
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Operating System 3 PROCESS DESCRIPTION AND CONTROL.
Chapter 3 Process Description and Control
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
OS, , Part II Processes Department of Computer Engineering, PSUWannarat Suntiamorntut.
Multiprogramming. Readings r Silberschatz, Galvin, Gagne, “Operating System Concepts”, 8 th edition: Chapter 3.1, 3.2.
3.1 : Resource Management Part2 :Processor Management.
What Every Developer Should Know about the Kernel Dr. Michael L. Collard 1.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Chapter 5 Processor Scheduling Introduction Processor (CPU) scheduling is the sharing of the processor(s) among the processes in the ready queue.
Concurrency & Context Switching Process Control Block What's in it and why? How is it used? Who sees it? 5 State Process Model State Labels. Causes of.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Process Program (Passive Entity) is a sequence of instructions, written to perform a specified task on a computer. A computer requires programs to function,
1  process  process creation/termination  context  process control block (PCB)  context switch  5-state process model  process scheduling short/medium/long.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
Managing Processors Jeff Chase Duke University. The story so far: protected CPU mode user mode kernel mode kernel “top half” kernel “bottom half” (interrupt.
Processes 2 Introduction to Operating Systems: Module 4.
CPU Scheduling Operating Systems CS 550. Last Time Deadlock Detection and Recovery Methods to handle deadlock – Ignore it! – Detect and Recover – Avoidance.
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.
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Processes and threads.
Process concept.
Process Management Process Concept Why only the global variables?
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Uniprocessor Scheduling
Intro to Processes CSSE 332 Operating Systems
Process Virtualization. Process Process is a program that has initiated its execution. A program is a passive entity; whereas a process is an active entity.
Structure of Processes
Chapter 6: CPU Scheduling
Computer System Overview
Introduction What is an operating system bootstrap
Process & its States Lecture 5.
TDC 311 Process Scheduling.
Process Description and Control
Process Description and Control
Operating System 3 PROCESS DESCRIPTION AND CONTROL
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Chapter 6: Scheduling Algorithms Dr. Amjad Ali
Chapter 3: Processes Process Concept Process Scheduling
Presentation transcript:

Scheduling Example 3 (1) Assume: FIFO Job Scheduling 100 K Main Memory Processor Sharing Process Scheduling (Cont…)

Scheduling Example 3 (2) JobArrivesRun Time Memory HOLDQ Ready / Running

Example 3 (Cont…) TimeEvent #Jobs Headway MM FreeTime Left A,S A,S F A,H A,S A,S F F S F F100 Must be memory size Must be sum of all Ri

T and W for Example 3 Job Run ArrivalFinish Ti Wi ===== ===== T = 0.72 W = 3.716

Scheduling Example 4 (1) Assume: FIFO Job Scheduling 100 K Main Memory Devices Processor Sharing Process Scheduling (Cont…)

Scheduling Example 4 (2) JobArrivesRun Time Memory Devices HOLDQ Ready / Running

Example 4 (Cont…) TimeEvent #Jobs Headway MM FreeDevices Time Left A,S A,S F A,H A,S A,H F S F F S F

T and W for Example 4 Job RunStartFinish Ti Wi ===== ===== T = 0.72 W = 4.026

Scheduling Example 5 (1) Assume: FIFO Job Scheduling 100 K Main Memory Devices Processor Sharing Process Scheduling (Cont…)

Scheduling Example 5 (2) JobArrivesRun Time Memory Tapes

Example 5 (Cont…) (1) TimeEvent #Jobs Headway MM FreeDevices Time Left 1.01 A,S A,S A,H A,S A,H F A,S

Example 5 (Cont…) (2) TimeEvent #Jobs Headway MM FreeDevices Time Left F S F F S F F

T and W for Example 5 Job Run ArrivalFinish Ti Wi ===== ===== T = 3.99 W = 4.35

Job Scheduling Also known as FCFS: first come, first served Scheduling based on arrival time Non-preemptible discipline Fair – no job is given preferential treatment, and every arriving job eventually runs Whey is this policy bad for interactive users Wait HoldReady Run

Process Management A multiprogramming OS must interleave the execution of multiple jobs The OS must decide when each process gets to use each resource (CPU,disk, etc.) The scheduler decides “when”

Time Quantums How does the OS interleave execution of many processes on the CPU? Ans: Time slicing Quantum: Amount of time given to jobs when time sharing

Process States Running: Process currently has CPU Ready: Process could use CPU, if CPU were free Blocked: Process is waiting for some event to occur: I/O Completion Buffer available from another process Data arrives from network (More states will be discussed later.)

Process State Transitions Running ReadyBlocked Wakeup Block Timeout Dispatch Is there a maximum number of processes in any state?

Suspend and Resume Ready Running Suspended ReadySuspended blocked Blocked Wakeup Suspend Resume Event (e.g., I/O) completion Timeout Dispatch Suspend Resume

Process Control Block (PCB) One PCB per process, containing all information about that process Process Identifier (pid) Parent’s pid State (e.g., Running, Blocked in ReadyQ) Priority Time at which its execution started Amount of CPU time consumed so far Copy of all register contents when process was last suspended Main memory used by process (e.g., base and bound registers, page table pointer) Accounting information Room for pointers to PCB into a queue File descriptor table

Context Switch A Context Switch occurs when a process exchange is made between the ready and run queues: Must: Save the state of the running process AND Restore the state of the ready process Run Ready

What happens on a Context Switch? (1) 1.Hardware: Resets Program Counter (PC to that of the interrupt handler (IH), which is an address in the OS kernel Switches from user to supervisor mode 2.Kernel: Copies A’s state from CPU registers to A’s PCB Sets A’s state to Ready or Blocked Inserts A’s PCB on ReadyQ or BlockedQ 3.Scheduler selects a new process to run (B), based on its scheduling discipline (Contd…)

What happens on a Context Switch? (2) 4. Kernel: Sets B’s state to Running Copies B’s state from B’s PCB to CPU registers 5.Kernel transfers control to B and thereby switches from kernel back to user context What machine instructions can achieve number 5?

Preemption Two classes of scheduling disciplines Premptive Scheduler takes CPU away from running job and gives it to another job Preempt upon arrival of higher priority job Non-premptive

Process Scheduling Algorithms (1) 1. Round Robin (RR) Each process runs either until Its time quantum expires or It blocks to perform I/O 2. Processor Sharing (PS) Limit of RR as time quantum goes to zero (Like giving each CPU cycle to a different process, in round robin fashion) N processes scheduled by PS = each job runs on dedicated N-fold slower CPU. Thus, READY = RUNNING

Process Scheduling Algorithms (2) 3. Priority Each process is statically assigned a priority; run high before low priority 4. Dynamic Priority Same as #3, except priority level of each process can change dynamically 5. Inverse of the Remainder of the Quantum Position in ready queue is determined by the amount of time remaining in the time slice (e.g., if ¾ of time slice is left, the job moves ¼ ahead in the ready queue)

Process Scheduling Algorithms (3) 6. Multiple-Level Feedback Variant on the Round Robin Current processes are forced to wait until new jobs “catch up” in time, then all RR 7. System Balance Balance system between I/O bound and CPU bound jobs 8. Preference to Interactive jobs Interactive jobs have higher priority