Operating Systems Part III: Process Management (Process States and Transitions)

Slides:



Advertisements
Similar presentations
Dr. Kalpakis CMSC 421, Operating Systems. Fall Processes.
Advertisements

Abhinav Kamra Computer Science, Columbia University 4.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 4: Processes Process Concept.
Adapted from slides ©2005 Silberschatz, Galvin, and Gagne Lecture 4: Processes.
Chapter 3: Processes.
Chapter 3 Processes.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 3: Processes.
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.
1/30/2004CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Process Concept n An operating system executes a variety of programs: –Batch system – jobs –Time-shared systems – user programs or tasks n Textbook uses.
Chapter 3: Processes. Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Operating System Concepts
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.
Silberschatz and Galvin  Operating System Concepts Module 4: Processes Process Concept Process Scheduling Operation on Processes Cooperating.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Chap 3 Processes-Concept. Process Concept Process – a program in execution; process execution must progress in sequential fashion A process includes:
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operation on Processes.
Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Inter-process Communication Communication in Client-Server.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems.
Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication in Client-Server.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Process Concept Process – a program.
4.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 4: Processes Process Concept Process Scheduling Operations on Processes.
Chapter 3 Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 4 Process Slide 1 Chapter 4 Process.
AE4B33OSS Chapter 3: Processes. 3.2Silberschatz, Galvin and Gagne ©2005AE4B33OSS Chapter 3: Processes Process Concept Process Scheduling Operations on.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Outline n Process Concept n Process.
Chapter 3: Processes (6 th edition chap 4). 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Chapter 3: Processes. 3.2CSCI 380 Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication.
1 11/1/2015 Chapter 4: Processes l Process Concept l Process Scheduling l Operations on Processes l Cooperating Processes l Interprocess Communication.
Chapter 2 Processes Processes Topics Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication.
Processes. Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
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.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Processes CSCI 4534 Chapter 4. Introduction Early computer systems allowed one program to be executed at a time –The program had complete control of the.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 3 Operating Systems.
Chapter 3: Process-Concept. Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
3.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Overview: Process Concept Process Scheduling Operations on Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
Chapter 3: Processes-Concept. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes-Concept Overview Process Scheduling.
Processes. Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems.
Lecture 4: Processes & Threads. Lecture 4 / Page 2AE4B33OSS Silberschatz, Galvin and Gagne ©2005 Contents The concept of Process Process states and life-cycle.
 Process Concept  Process Scheduling  Operations on Processes  Cooperating Processes  Interprocess Communication  Communication in Client-Server.
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 ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server.
Chapter 3: Process-Concept. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 3: Process-Concept Process Concept Process Scheduling.
4.1 Operating System Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
XE33OSA Chapter 3: Processes. 3.2XE33OSASilberschatz, Galvin and Gagne ©2005 Chapter 3: Processes Process Concept Process Scheduling Operations on Processes.
Operating System Components) These components reflect the services made available by the O.S. Process Management Memory Management I/O Device Management.
Chapter 3: Process Concept
Operating System Concepts
Processes Overview: Process Concept Process Scheduling
Chapter 3: Process Concept
Applied Operating System Concepts
Chapter 4: Processes Process Concept Process Scheduling
Lecture 2: Processes Part 1
Presentation transcript:

Operating Systems Part III: Process Management (Process States and Transitions)

Process Definition Definition (informal): A process is a program in execution Referred to as a job in batch systems and user program / task in time-shared systems More broadly: all CPU activities (includes user programs, internal O/S activities, etc.)

Process States Processes are executed sequentially Process States: – New: process is being created – Running: instructions are being executed – Waiting: waiting for an event (i.e. I/O completion) – Ready: waiting to be assigned to a processor – Terminated: process has finished execution

Process States newwaiting runnin g ready termina ted admitted interrupt exit scheduler dispatch I/O or event wait I/O or event completion

Process Control Block Each process is represented by a process control block (PCB) Information contained in PCB: – Process state – Program counter: address of next instruction – CPU registers: accumulators, index registers, stack pointers -- must be saved when interrupt occurs

Process Control Block Information in PCB (continued) – CPU scheduling information - process priority & scheduling parameters – Memory-management information - page tables, etc. – Accounting information - amount of CPU USED – I/O status information - list of I/O devices allocated to this process, list of open files, etc.

Process Scheduling Processes are put in a job queue (consists of all processes) Processes residing in main memory (ready and waiting) are kept in ready queue Uni-processor (only one running process at a time); multiprocessor (# of processes running depend on # of processors)

Process Scheduling Long-term scheduler (a.k.a. job scheduler) - selects processes from mass storage device and loads into main memory for execution Short-term scheduler (a.k.a. CPU scheduler) - selects from ready to execute processes and allocates CPU to one of them

Process Scheduling CPU-bound process - spends more time doing computation I/O-bound process - spends more time doing I/O Medium-term scheduler - removes some processes in main memory and then later reintroduced to continue execution --> also called swapping

Process Scheduling Job Queue (New) Secondary Memory Main Memory Ready Queue (Ready) CPU (Running) long - term / job scheduler short - term / CPU scheduler I/O Queue (Waiting) Portion of Virtual Memory medium - term scheduler / swapper I/O I/O complete I/O request interrupt Exit (Terminated)

Process Scheduling Context switch – CPU switching from one process to another – Purely overhead because system does no useful work – Value of registers must be copied to PCB – Speed ranges vary from machine to machine (but typically 1 to 1000 microseconds)

Operation in Processes Process creation – Created via a create-process system call – Creating process is the parent process and the new process is the child process – Forms a tree of processes

Operation in Processes Process creation (continued) – Two possibilities (execution) Parent continues to run concurrently w/ children Parent waits until some/all children have finished – Two possibilities (address space) Child has duplicate of parent address space Child has program loaded into parent address space

Operation in Processes Process creation (continued) – In Unix, new process is created using the fork system call Parent continues execution Copy of address space is created – Also in Unix, execve is similar to fork except Parent “dies” Memory space replaced by child

Operation in Processes Process termination – Normally terminates w/ exit system call (Unix) – All resources are deallocated by O/S – Other circumstances Parent terminates child (i.e. abort) – Child exceeded usage of resources – Child is no longer required – Parent is exiting, O/S does not allow child to exist without parent Process killed by other processes (user’s own)

Cooperating Processes Independent process - cannot affect or be affected by other processes (does not share any data) Dependent process - if it can affect or be affected by other processes (shares data with other processes)

Cooperating Processes Reasons for sharing data w/ other processes – Information sharing – Computation speedup - break complex task into subtasks – Modularity - divide a system into separate processes – Convenience - work on many tasks at the same time (editing/printing/compiling)

Cooperating Processes An illustration – Producer-consumer problem: producer produces information for the consumer to consume (i.e. print program and printer device) – Unbounded-buffer -> no limit on size of buffer but consumer has to wait for new items – Bounded-buffer -> fixed buffer (consumer waits if buffer is empty, producer if full)

Threads Allows sharing of resources among peers Also called a lightweight process (LWP) Has a program counter, register set, and stack space Shares with peer threads its code section, data section, O/S resources (collectively known as a task)

Threads Traditional task (heavyweight process) has exactly one thread Threads makes CPU switching among peers less expensive than among heavyweight processes (no memory mgt.)

Threads Similar to processes since a thread – has states (ready, running, blocked, terminated) – can create child threads – shares CPU

Threads Unlike a process, threads – are not independent of each other – can access every address in the task – have no protection from other threads since threads are meant to assist and not be hostile to one another Threads are gaining ground because they execute more efficiently

Interprocess Communication Cooperating processes communicate through a shared-memory environment Another means is through an interprocess- communication (IPC) facility – Achieved through a messaging system Function of message system is to allow process communication without resorting to shared variables

Interprocess Communication IPC provides at least two basic functions: – send(message) – receive(message) A communication link must exist between two or more processes Unidirectional link – can either send or receive but NOT BOTH and each link has at least one receiver process connected to it

Interprocess Communication Processes refer to each other through names Name referencing is used in direct and indirect communication Direct communication – send(process_name,message) – receive(process_name,message) – The link is exactly between two processes and usually bi-directional (sometimes unidirectional)

Interprocess Communication Direct communication (continued) – Example: Producer-consumer problem: when producer finishes, it sends to the consumer – Symmetric – sender and receiver indicate process name – Asymmetric – only the sender specifies the process name; receiver can receive message from any process – Disadvantage: limited modularity (e.g. when process changes name)

Interprocess Communication Indirect communication – Messages sent through a mailbox send(mailbox_name,message) receive(mailbox_name,message) – Link is established between processes ONLY through a shared mailbox – Mailbox may be owned by either the process or the system – Mailboxes owned by the process are destroyed when process terminates

Interprocess Communication Buffering – Link capacity determines number of messages that can reside in it temporarily – Zero capacity No messages can wait in buffer Sender waits until recipient receives Must be synchronized to transfer a message (rendezvous)

Interprocess Communication Buffering (continued) – Bounded capacity With finite length n Sender waits if buffer is full – Unbounded capacity Sender never delays

Communication in Client-Server Systems Socket – An endpoint for communication – A link consists of two sockets RPC (Remote Procedure Call) – Allows a local process to invoke a procedure on a remote host as if accessing a local procedure RMI (Remote Method Invocation) – The Java implementation of RPC