CHAPTER 2 PROCESSOR SCHEDULING PART I By U ğ ur HALICI.

Slides:



Advertisements
Similar presentations
Processes Management.
Advertisements

Topic : Process Management Lecture By: Rupinder Kaur Lecturer IT, SRS Govt. Polytechnic College for Girls,Ludhiana.
Operating Systems: Introduction n 1. Historical Development n 2. The OS as a Resource Manager n 3. Definitions n 4. The Process.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Processes and Their Scheduling.
A. Frank - P. Weisberg Operating Systems Process Scheduling and Switching.
Chapter 3: CPU Scheduling
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
CE Operating Systems Lecture 5 Processes. Overview of lecture In this lecture we will be looking at What is a process? Structure of a process Process.
CPU-Scheduling Whenever the CPU becomes idle, the operating system must select one of the processes in the ready queue to be executed. The short term scheduler.
CPU Scheduling Chapter 6 Chapter 6.
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.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
CPU Scheduling Gursharan Singh Tatla 1-Feb-20111www.eazynotes.com.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling To improve: Response time: time it takes a system to react to a given input Turnaround Time (TAT)
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
Multiprogramming. Readings r Silberschatz, Galvin, Gagne, “Operating System Concepts”, 8 th edition: Chapter 3.1, 3.2.
3.1 : Resource Management Part2 :Processor Management.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Computer Studies (AL) Operating System Process Management - Process.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems with Multi-programming Chapter 4.
CIS250 OPERATING SYSTEMS Chapter 6 - CPU Scheduling Basic Concepts The objective of multi-programming is have a program running at all times Maximize.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
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, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: Process Scheduling.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Processes. Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Processes 2 Introduction to Operating Systems: Module 4.
CPU Scheduling CSCI Introduction By switching the CPU among processes, the O.S. can make the system more productive –Some process is running at.
14/06/ :48:20 CSC Alliance — 1 Kimera Richard Phone: INSTITUTE OF COMPUTER SCIENCE DEPARTMENT.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Processes and threads.
Copyright ©: Nahrstedt, Angrave, Abdelzaher
Process Management Process Concept Why only the global variables?
Chapter 3: Process Concept
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Copyright ©: Nahrstedt, Angrave, Abdelzaher
Operating Systems (CS 340 D)
Sujata Ray Dey Maheshtala College Computer Science Department
OPERATING SYSTEMS CS3502 Fall 2017
Chapter 3: Process-Concept
Chapter 3: Processes.
Uniprocessor Scheduling
Intro to Processes CSSE 332 Operating Systems
CPU scheduling 6. Schedulers, CPU Scheduling 6.1. Schedulers
Operating Systems (CS 340 D)
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.
Operating Systems CPU Scheduling.
Process management Information maintained by OS for process management
Lecture 2: Processes Part 1
Chapter 6: CPU Scheduling
Processes and CPU Scheduling
Introduction What is an operating system bootstrap
Operating System Concepts
Process & its States Lecture 5.
TDC 311 Process Scheduling.
Chapter 3: Processes.
Sujata Ray Dey Maheshtala College Computer Science Department
Chapter 3: Processes.
Uniprocessor scheduling
Chapter 6: Scheduling Algorithms Dr. Amjad Ali
Chapter 3: Processes Process Concept Process Scheduling
Presentation transcript:

CHAPTER 2 PROCESSOR SCHEDULING PART I By U ğ ur HALICI

2.1 Processes  A process is an executing program, including the current values of the program counter, registers, and variables.  The subtle difference between a process and a program is that the program is a group of instructions whereas the process is the activity.

2.1 Processes  In multiprogramming systems, processes are performed in a pseudo parallelism as if each process has its own processor.  In fact, there is only one processor but it switches back and forth from one process to another.

2.1 Processes  Henceforth, by saying execution of a process, we mean the processor’s operations on the process like changing its variables, etc.  I/O work means the interaction of the process with the I/O operations like reading something or writing to somewhere.  They may also be named as “processor (CPU) burst” and “I/O burst” respectively

2.1 Processes  According to these definitions, we classify programs as  Processor-bound program: A program having long processor bursts (execution instants).  I/O-bound program: A program having short processor bursts.

2.1 Processes Assume we have two processes A and B. Both execute for 1 second and do some I/O work for 1 second. This pattern is repeated 3 times for process A and 2 times for process B. Exec A1 I/O A1 Exec A2 I/O A2 Exec A3 I/O A3 Exec B1 I/O B1 Exec B2 I/O B2

2.1 Processes If we have no multiprogramming, the processes are executed sequentially as below. So, the processor executes these two processes in a total time of 10 seconds. However, it is idle at I/O instants of processes. So, it is idle for 5 seconds and utilized for 5 seconds. Then the processor utilization is Exec A1 I/O A1 Exec A2 I/O A2 Exec A3 I/O A3 Exec B1 I/O B1 Exec B2 I/O B2 Time A enters B enters A leavesB leaves

2.1 Processes Now let’s consider multiprogramming case: (Gannt chart) In this case, when process A passes to some I/O work (i.e. does not use the processor), processor utilizes its time to execute process B instead of being idle. Here the processor utilization is A B AB CPUA1B1A2B2A3idle I/0idleA1B1A2B2A3

2.2 Process States Start : The process has just arrived. Ready : The process is waiting to grab the processor. Running : The process has been allocated by the processor. Waiting : The process is doing I/O work or blocked. Halted : The process has finished and is about to leave the system I/O requested I/O completed START WAITING READY RUNNING HALTED

2.2 Process States  In the OS, each process is represented by its PCB (Process Control Block). The PCB, generally contains the following information: Process State Process ID, Program Counter (PC) value, Register values Memory Management Information (page tables, base/bound registers,…) Processor Scheduling Information( priority, last processor burst time etc.) I/O Status Info (outstanding I/O requests, I/O devices held, etc.) List of Open Files Accounting Information

2.2 Process States If we have a single processor in our system, there is only one running process at a time. Other ready processes wait for the processor. The system keeps these ready processes (their PCBs) on a list called Ready Queue which is generally implemented as a linked-list structure. When a process is allocated by the processor, it executes and after some time it either finishes or passes to waiting state (for I/O). The list of processes waiting for a particular I/O device is called a Device Queue. Each device has its own device queue.

2.2 Process States  In multiprogramming systems, the processor can be switched from one process to another.  Note that when an interrupt occurs, PC and register contents for the running process (which is being interrupted) must be saved so that the process can be continued correctly afterwards.

2.2 Process States  Switching between processes occurs as depicted below: Execution of A Save PC A Save REGISTERS A Load PC B Load REGISTERS B (Context Switching ) Execution of B Execution of A Save PC B Save REGISTERS B Load PC A Load REGISTERS A (Context Switching )

2.3 Scheduler  If we consider batch systems, there will often be more processes submitted than the number of processes that can be executed immediately.  So incoming processes are spooled (to a disk).  The long-term scheduler selects processes from this process pool and loads selected processes into memory for execution.

2.3 Scheduler  The short-term scheduler selects the process to get the processor from among the processes which are already in memory.  The short-time scheduler will be executing frequently (mostly at least once every 10 milliseconds).  So it has to be very fast in order to achieve a better processor utilization.  The short-term scheduler, like all other OS programs, has to execute on the processor.  If it takes 1 millisecond to choose a process that means ( 1 / ( )) = 9% of the processor time is being used for short term scheduling and only 91% may be used by processes for execution.

2.3 Scheduler  The long-term scheduler on the other hand executes much less frequently.  It controls the degree of multiprogramming (no. of processes in memory at a time).  If the degree of multiprogramming is to be kept stable (say 10 processes at a time), then the long- term scheduler may only need to be invoked when a process finishes execution.

2.3 Scheduler Time-sharing systems (mostly) have no long-term scheduler. The stability of these systems either depends upon a physical limitation (no. of available terminals) or the self- adjusting nature of users (if you can't get response, you quit). It can sometimes be good to reduce the degree of multiprogramming by removing processes from memory and storing them on disk. These processes can then be reintroduced into memory by the medium-term scheduler. This operation is also known as swapping. Swapping may be necessary to improve the process mix or to free memory.

2.4. Performance Criteria  In order to achieve an efficient processor management, OS tries to select the most appropriate process from the ready queue.  For selection, the relative importance of the followings may be considered as performance criteria.

2.4. Performance Criteria  Processor Utilization: The ratio of busy time of the processor to the total time passes for processes to finish. Processor Utilization = (Processor buy time) / (Processor busy time + Processor idle time)  We would like to keep the processor as busy as possible.

2.4. Performance Criteria  Throughput: The measure of work done in a unit time interval. Throughput = (Number of processes completed) / (Time Unit)

2.4. Performance Criteria  Turnaround Time (tat): The sum of time spent in the ready queue, execution time and I/O time. tat = t(process completed) – t(process submitted)

2.4. Performance Criteria  Waiting Time (wt): Time spent only in ready queue. Processor scheduling algorithms only affect the time spent waiting in the ready queue. So, considering only waiting time instead of turnaround time is generally sufficient.

2.4. Performance Criteria  Response Time (rt): The amount of time it takes to start responding to a request. This criterion is important for interactive systems. rt = t(first response) – t(submission of request) the time that the process starts execution

2.4. Performance Criteria  We, normally, want to maximize the processor utilization and throughput, and minimize tat, wt, and rt.  However, sometimes other combinations may be considered depending on the system requirements.  For example, for the time sharing systems, response time is quite important.