PROCESS MANAGEMENT Y. Colette LeMard.

Slides:



Advertisements
Similar presentations
I/O Management and Disk Scheduling
Advertisements

Operating Systems Chapter 6.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Categories of I/O Devices
Computer Architecture
Processes Management.
Chapter 3 Process Description and Control
Topic : Process Management Lecture By: Rupinder Kaur Lecturer IT, SRS Govt. Polytechnic College for Girls,Ludhiana.
Lecture 11: Operating System Services. What is an Operating System? An operating system is an event driven program which acts as an interface between.
Chapter 3: CPU Scheduling
Process Description and Control Module 1.0. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling The key to multiprogramming is scheduling Scheduling is done to meet the goals of –Response time.
Chapter 1 and 2 Computer System and Operating System Overview
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (2) Process Management 10/03/2008 Yang Song (Prepared by Yang Song and.
Device Management.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
Process Description and Control A process is sometimes called a task, it is a program in execution.
FUNCTIONS OF OPERATING SYSTEMS Interfaces Memory Management Security Utility Interrupt Handling.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Chapter 3 Operating Systems Introduction to CS 1 st Semester, 2015 Sanghyun Park.
 Scheduling  Linux Scheduling  Linux Scheduling Policy  Classification Of Processes In Linux  Linux Scheduling Classes  Process States In Linux.
CHAPTER 5 I/O PRINCIPLE Understand the principles of System Bus
Chapter 6: CPU Scheduling
Chapter 4 Processor Management
Chapter 6 CPU SCHEDULING.
Operating Systems  By the end of this session, you will know: What an Operating System is. The functions it performs.
I/O Resource Management The operating system is responsible for: Issuing commands to I/O devices Handling all interrupts and errors generated by the.
 Introduction to Operating System Introduction to Operating System  Types Of An Operating System Types Of An Operating System  Single User Single User.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Operating Systems Process Management.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Introduction to Concurrency.
3.1 : Resource Management Part2 :Processor Management.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
O PERATING S YSTEM. What is an Operating System? An operating system is an event driven program which acts as an interface between a user of a computer,
The Functions of Operating Systems Scheduling(multi-programming)
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.
CS 390 Unix Programming Environment
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Process Control Management Prepared by: Dhason Operating Systems.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
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.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Operating System (Reference : OS[Silberschatz] + Norton 6e book slides)
9691 Computing Paper 3 Section 3.1 The functions of Operating Systems.
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Resource Management IB Computer Science.
Processes and threads.
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Component 2 6G, H, I, J, K.
Lesson Objectives Aims Key Words Interrupt, Buffer, Priority, Stack
Advanced OS Concepts (For OCR)
Process Description and Control
Process management Information maintained by OS for process management
Processor Management Damian Gordon.
Chapter 6: CPU Scheduling
Operating System Concepts
Processor Fundamentals
Chapter 5: CPU Scheduling
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Processor Management Damian Gordon.
Chapter 3: Process Management
Presentation transcript:

PROCESS MANAGEMENT Y. Colette LeMard

PROCESS MANAGEMENT The management of running programs is one of the functions of the Operating System

A program is only regarded as a process when it is being executed. Process Management The basic unit of software that the operating system deals with is … a process. A process is defined as a running program (It exists in memory, is performing some action and can be controlled by a user, an application or the operating system). A program is only regarded as a process when it is being executed.

Processes may be system processes or application processes Examples of processes are : A game being played MS Word running Data being transmitted along a network Antivirus software running Processes may be system processes or application processes

Processes In order for processes to run properly to completion they need computer resources such as : CPU time Memory Files (on secondary storage devices) and I/O devices in order to complete their tasks.

Processes Resources are normally allocated to the process when it is created Processes may also require initialization data and these are also supplied on creation.

Processes Processes are created when the program first begins to run. It may be started by the O/S itself, by a utility or by a user/application program

Processes As a process runs there are several possible states that it may be in depending on what is happening in the process itself, and also in the overall system

Processes The states are : READY – the process can use the CPU if the CPU is available RUNNING – The process is being executed by the CPU BLOCKED – The process is waiting for an event to happen before it can continue. Otherwise called “waiting” ENDED - The process is no longer running

Process Management Process States Ended Running Created Ready Waiting

Process Management Any number of processes can be READY at the same time so a READY QUEUE is maintained for all processes hoping to run soon. Only one process at a time can have the status RUNNING A queue of BLOCKED or WAITING processes is also maintained.

Process Management Managing the queues and the execution of programs is one of the major roles of the O/S.

The operating system performs many tasks on processes as they execute Process Management The operating system performs many tasks on processes as they execute

Process Management The O/S can 1. Create a process : the program is brought into memory (RAM) and given a process control block. Its status is then set to READY

Process Management The PCB is a small piece of memory that stores information about a running program. Every process has a PCB Typically the PCB stores the following data : the process id, the user name, the time started, the priority, the state, the time elapsed, data registers, etc..

Process Management process descriptor in your syllabus The PCB is sometimes called the process descriptor in your syllabus

Process Management The O/S can 2. Destroy / Kill a process : this involves terminating a process before it has run to completion. This may be initiated by the user, the application or the system and then performed by the O/S.

Process Management The O/S can 3. Suspend a process : the process is paused as the CPU’s attention is given to another process. Its status is changed to either WAITING or READY and it goes to the appropriate queue

Process Management The O/S can 4. Resume a process : a suspended process once again regains the attention of the CPU. It’s status therefore becomes running

Process Management The O/S can : 5. Change a process’ priority : The priority is a rating that determines the process’ position in the ready queue. The priority can be upgraded or downgraded, making the process more important or less important, and thus changing how long a waiting time it has.

Process Management A single CPU can only attend to one process at a time. Yet many O/Ss give the appearance that they can simultaneously run many programs.

Process Management When the Operating System executes more than one process concurrently so that they appear to be running at the same time, it is said to be multiprogramming. They are active in memory at the same time but only one is being executed by the CPU

Process Management The CPU is so fast that it appears that it is doing several things at the same time when in fact it is doing them one after the other in small time slices.

Process Management Multiprogramming An operating system managing several processes at the same time so it appears as if they all being executed by the CPU at the same time.

Process Management One way of accomplishing this : The operating system assigns a time slice to every process that it creates in units of CPU cycles. Once it is not interrupted, the process has the attention of the CPU for that number of cycles. The other processes wait in the ready queue

Process Management When the time is up the process state is set to ready and stored in the PCB along with the current data. The CPU then moves the process to the back of the ready queue. The CPU next takes the process at the front of the ready queue and begins to work on it. It runs for that time slice and the technique is repeated.

Process Management Eventually the earlier process gets another time slice. This is called the round-robin approach The combination of the small time slice and the speed of the CPU means that it appears that all the processes are running at the same time. This complex operation is managed by the operating system.

Process Management Shortest job first (SJF) The O/S uses one of the following techniques called Scheduling Algorithms to decide which program will run next. Shortest job first (SJF) Shortest remaining time first (SRTF) These are called pre-emptive algorithms Based on a characteristic of the process

Process Management 4. First come first serve (FCFS) Scheduling Algorithms cont’d 4. First come first serve (FCFS) Priority scheduling Round robin These are called non-pre-emptive algorithms

Process Management . Note : the O/S aims to do the following : Process the maximum number of jobs Be as fair to each user as possible Provide acceptable response times to online users Keep the devices busy Avoid deadlock Degrade gracefully, instead of freezing, if the system is overloaded.

Process Management Often an operating system uses a combination of strategies. Example Shortest job first may be combined with priority scheduling. After all, if two or more jobs have the same priority some other mechanism must be used to decide which gets executed first.

Process Management Questions ?

Process Management There are times when a process needs the attention of the CPU even though it may not be its time to run yet.

Process Management External operations such as getting data from the disk or printing (I/O operations) are much, much slower than the CPU. So instead of waiting for these operations to complete, the O/S will block that process (set it to waiting) and send another one which is ready to the CPU

Process Management E.g. when a process needs data or is printing. When the print starts the CPU sends the request to the device driver and the O/S moves the process into the waiting queue.

Process Management When the I/O operation is complete the waiting process generates an INTERRUPT to the O/S. An interrupt is a special signal sent by the hardware or the software to gain the CPU’s attention.

Process Management Interrupt generated by a running process There are four types of interrupts : Interrupt generated by a running process Input/output interrupt External interrupt Restart interrupt

Process Management e.g. A hardware interrupt is sent by printers to the CPU to tell it when they have finished printing a job

Process Management The CPU will then respond by completing the step it is on, pausing what it was doing and storing the data for the current process in its PCB,

Process Management It will then check to see the type of interrupt, go to the interrupt routines to determine how to handle this particular interrupt, and then execute the interrupt routine. When it is finished handling the interrupt it puts the job in the ready queue and then return to the original process.

Process Management While this sounds like a long process, it is usually done in a few millionths of a second so that the user does not even know that it has happened. Sometimes there can be scores of interrupts per second.

Process Management Interrupts can be generated by : Hardware device not working properly A mouse click A Keyboard character pressed Drive fault System error Printing finished

QUESTIONS ?

Process Management LOCKS When a process is using a resource it locks it, so that there can be no conflict in use. This prevents lots of possible errors e.g. two users trying to change the same data at the same time.

Process Management However when several processes are attempting to use a number of resources, it is possible for a situation known as DEADLOCK to occur.

Example … Lets say Process1 opened a file called FileA. It then attempts to use the printer. Process2 is however using the printer so ProcessI has to wait.

While still using the printer Process2 finds a need to use FileA While still using the printer Process2 finds a need to use FileA. When it attempts to do so it finds that FileA is already in use by Process1. So Process2 goes to the waiting queue to wait on Process1 to free up the file.

So both are in the waiting queue waiting on each other - This will never happen because Process1 is also in the wait queue waiting on Process2. So both are in the waiting queue waiting on each other - Thus we have DEADLOCK

If deadlock does occur the O/S is allowed to end a process. Process Management To avoid deadlocks we can take the following steps: Do not allow a process to start until all its resources are available Always allocate resources in the same sequence e.g. data then printer If deadlock does occur the O/S is allowed to end a process.

Classifications of Operating Systems Single user – an o/s designed to be used by one person at a time Multi-user - allows several users access concurrently; eg midrange systems such as mainframes where one computer has many users running different programs from multiple attached terminals

Classifications of Operating Systems Single tasking – an o/s that can only execute one process at a time Multiprogramming – capable of executing several processes at once by use of a scheduling algorithm for the CPU

Classifications of Operating Systems Multiprocessing – having more than one processor available for running processes Network O/S – runs on a main controlling computer (server) and provides communication and routing services so that clients can share data, programs, etc

QUESTIONS ?

P.M. Heathcote and S. Langfield Text : A’ Level Computing By P.M. Heathcote and S. Langfield Pages 284 – 286, 293

QUESTION In a batch programming environment, the following 3 programs are ready to run: a payroll program, a complicated scientific calculation and the printing of a long queue of reports Explain one reason for giving the queue of reports the highest priority Explain one reason why the scientific calculation should be given the lowest priority

THE END