Process & its States Lecture 5.

Slides:



Advertisements
Similar presentations
Processes Management.
Advertisements

A. Frank - P. Weisberg Operating Systems Process Scheduling and Switching.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Objectives Understand Process concept Process scheduling Creating.
Processes CSCI 444/544 Operating Systems Fall 2008.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
CMPT 300: Operating Systems I Ch 3: Processes Dr. Mohamed Hefeeda
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
1/26/2007CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
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.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication in Client-Server.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
Processes: program + execution state
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
8-Sep Operating Systems Yasir Kiani. 8-Sep Agenda for Today Review of previous lecture Process scheduling concepts Process creation and termination.
Chapter 2 Processes Processes Topics Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Processes. Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
Computer Studies (AL) Operating System Process Management - Process.
Processes – Part I Processes – Part I. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Review on OSs Upon brief introduction of OSs,
11/13/20151 Processes ICS 240: Operating Systems –William Albritton Information and Computer Sciences Department at Leeward Community College –Original.
CS212: OPERATING SYSTEM Lecture 2: Process 1. 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 3: Processes.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Processes Dr. Yingwu Zhu. Process Concept Process – a program in execution – What is not a process? -- program on a disk - a process is an active object,
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
 Process Concept  Process Scheduling  Operations on Processes  Cooperating Processes  Interprocess Communication  Communication in Client-Server.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 8 Processes II Read Ch.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Operating System Components) These components reflect the services made available by the O.S. Process Management Memory Management I/O Device Management.
Lecture 3 Process.
Processes and threads.
Chapter 3: Processes.
Process Management Process Concept Why only the global variables?
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Operating System Concepts
Operating Systems (CS 340 D)
Sujata Ray Dey Maheshtala College Computer Science Department
Process Management Presented By Aditya Gupta Assistant Professor
Processes Overview: Process Concept Process Scheduling
Chapter 3: Process Concept
Chapter 3: Processes Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Chapter 3: Processes.
Intro to Processes CSSE 332 Operating Systems
Operating Systems (CS 340 D)
Chapter 3: Processes.
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.
CGS 3763 Operating Systems Concepts Spring 2013
Chapter 4: Processes Process Concept Process Scheduling
Lecture 2: Processes Part 1
ICS 143 Principles of Operating Systems
Recap OS manages and arbitrates resources
Operating Systems Lecture 6.
Operating Systems Lecture 5.
Chapter 3: Processes.
Operating System Concepts
Process Description and Control
Sujata Ray Dey Maheshtala College Computer Science Department
Chapter 3: Processes.
Processes – Part I.
Outline Chapter 2 (cont) Chapter 3: Processes Virtual machines
Chapter 3: Processes Process Concept Process Scheduling
Chapter 3: Process Concept
Presentation transcript:

Process & its States Lecture 5

What is a Process? A process is a program during execution. A process is the basic unit of execution in an operating system. Different processes may run different instances of the same program. At a minimum, process execution requires following resources: Memory to contain the program code and data. A set of CPU registers to support execution.

What is a Process? Process – a program in execution; process execution must progress in sequential fashion. A process consists of: Code (text) section Data section Stack Heap Environment CPU state (program counter, etc.) Process control block (PCB)

WHY HAVE PROCESSES? Resource sharing ( logical (files) and physical(hardware) ). Computation speedup - taking advantage of multiprogramming – i.e. example of a customer/server database system. Modularity for protection.

CPU and I/O Bound Processes Processes can be: I/O-bound process – spends more time doing I/O than computations, many short CPU bursts. I/O Burst CPU Burst CPU-bound process – spends more time doing computations; few very long CPU bursts. CPU Burst I/O

Process States As a process executes, it changes state new: The process is being created. ready: The process is waiting to be assigned to a processor. running: Instructions are being executed. waiting: The process is waiting for some event to occur. terminated: The process has finished execution.

Process States

Process Control Block (PCB) Process information and attributes Process state Program counter CPU registers CPU scheduling information Memory-management information Accounting information I/O status information Per process file table Process ID (PID) Parent PID, etc.

Process Control Block (PCB)

CPU Switch From Process to Process

Process Scheduling Queues Job queue – set of all processes in the system. Ready queue – set of all processes residing in main memory, ready and waiting to execute. Device queues – set of processes waiting for I/O devices. Process migration between the various queues.

Queues in the OS

Queues in a Computer System

Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O device. Swap these processes to disk to free up more memory and use processor on more processes.. Blocked state becomes suspend state when swapped to disk. Two new states Blocked/Suspend Ready/Suspend

One Suspend State

Two Queues Diagram

Multiple Blocked Queues

Long Term Scheduler Long-term scheduler (or job scheduler) – selects processes from the job pool to be brought into the ready queue. Long-term scheduler is invoked very infrequently (seconds, minutes)  (may be slow). The long-term scheduler controls the degree of multiprogramming. More processes, smaller percentage of time each process is executed

Short Term Scheduler Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates it the CPU through the dispatcher. Short-term scheduler is invoked very frequently (milliseconds)  (must be fast). Invoked when following events occur CPU slice of the current process finishes Current process needs to wait for an event Clock interrupt I/O interrupt System call Signal

Medium Term Scheduler Also known as swapper Selects an in-memory process and swaps it out to the disk temporarily Swapping decision is based on several factors Arrival of a higher priority process but no memory available Poor mix of jobs Memory request of a process cannot be met

Addition of Medium Term Scheduling

PROCESSES INTERRUPT HANDLER In addition to doing device work, it also readies processes, moving them, for instance, from waiting to ready. Short Term Scheduler Medium Term Scheduler Short Term Scheduler Long Term Scheduler Interrupt Handler

Reasons Swapping: OS Reason: The OS need to make space for execute the process that in ready state. OS Reason: Operating system suspects the process faulty or causing a problem.

Context Switch When CPU switches to another process, the system must save the state (context) of the ‘current’ (old) process and load the saved state for the new process. Context-switch time is overhead; the system does no useful work while switching. Time dependent on hardware support; typically in microseconds

Process Creation Parent process create children processes, which, in turn create other processes, forming a tree of processes. Resource sharing Parent and children share all resources. Children share a subset of parent’s resources. Parent and child share no resources. Execution Parent and children execute concurrently. Parent waits until children terminate.

Process Creation … Address space Child duplicate of parent. Child has a program loaded onto it. UNIX examples fork system call creates a new process exec system call used after a fork to replace the process’ memory image with a new executable.

Processes Tree on a UNIX System 6 December 2018 © Copyright Virtual University of Pakistan

Process Termination Process executes the last statement and requests the operating system to terminate it (exit). Output data from child to parent (via wait). Process resources are deallocated by the operating system, to be recycled later.

Process Termination There must be some way that a process can indicate completion. This indication may be: A HALT instruction generating an interrupt alert to the OS. A user action (e.g. log off, quitting an application) A fault or error Parent process terminating

Process Termination … Parent may terminate execution of children processes (abort). Child has exceeded allocated resources (main memory, execution time, etc.). Parent needs to create another child but has reached its maximum children limit Task performed by the child is no longer required. Parent exits. Operating system does not allow child to continue if its parent terminates. Cascaded termination