1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.

Slides:



Advertisements
Similar presentations
Chapter 3 Process Description and Control
Advertisements

Process management Information maintained by OS for process management  process context  process control block OS virtualization of CPU for each process.
Operating Systems COMP 4850/CISG 5550 Processes Introduction to Threads Dr. James Money.
Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
CSC 501 Lecture 2: Processes. Von Neumann Model Both program and data reside in memory Execution stages in CPU: Fetch instruction Decode instruction Execute.
The Process Model.
Process Description and Control Module 1.0. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
1 Processes Professor Jennifer Rexford
Page 1 Processes and Threads Chapter 2. Page 2 Processes The Process Model Multiprogramming of four programs Conceptual model of 4 independent, sequential.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
1/27/2010CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying an earlier version.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
CSSE Operating Systems
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
Processes April 5, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
Process Description and Control A process is sometimes called a task, it is a program in execution.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Process Description and Control
Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Introduction to Processes CS Intoduction to Operating Systems.
Implementing Processes and Process Management Brian Bershad.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
PROCESSES TANNENBAUM, SECTION 2-1 OPERATING SYSTEMS.
Chapter 3 Process Description and Control
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
REVIEW OF COMMONLY USED DATA STRUCTURES IN OS. NEEDS FOR EFFICIENT DATA STRUCTURE Storage complexity & Computation complexity matter Consider the problem.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
OS, , Part II Processes Department of Computer Engineering, PSUWannarat Suntiamorntut.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Processes – Part I Processes – Part I. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Review on OSs Upon brief introduction of OSs,
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
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.
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.
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Process Control Management Prepared by: Dhason Operating Systems.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Lecture 3 Process.
Process Management Process Concept Why only the global variables?
Operating Systems: A Modern Perspective, Chapter 6
Chapter 3: Processes.
Chapter 3: Processes.
Structure of Processes
Chapter 3: Processes.
PROCESS MANAGEMENT Information maintained by OS for process management
Process Description and Control
Processes Hank Levy 1.
Process Description and Control
Processes and Process Management
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Process Description and Control
Process Description and Control
Process Description and Control
Process Description and Control
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Processes in Unix and Windows
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
CS510 Operating System Foundations
Process Description and Control in Unix
Processes Hank Levy 1.
Process Description and Control in Unix
Chapter 3: Process Concept
Presentation transcript:

1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads Threads

2 What is a Process? A process (task) is the activity resulting from the execution of a program with its data on a sequential processor A process (task) is the activity resulting from the execution of a program with its data on a sequential processor A process is an abstract form of a program A process is an abstract form of a program

3 Sequential Execution Programs are run one after the other (run to completion) Programs are run one after the other (run to completion) Program 2Program 1Program 3 Start Terminate

4 Concurrent Execution All programs execute concurrently (share the time of the CPU) All programs execute concurrently (share the time of the CPU) Program 2Program 1Program 3 Start Terminate Start Terminate

5 How to Implement Concurrency? Separate a program into code, data and environment (Process table) segments Separate a program into code, data and environment (Process table) segments Process table contains all the necessary data to stop and restart a process at any time Process table contains all the necessary data to stop and restart a process at any time Start Terminate Start Terminate Code 1 Data 1 PCB 1 Code 2 Data 2 PCB 2 Code 3 Data 3 PCB 3

6 Process Table (PCB - Process Control Block) Contents of registers Contents of registers Program counter Program counter PSW (Program Status Word) PSW (Program Status Word) Process state Process state Pointers to code and data Pointers to code and data Process identifier (PID) Process identifier (PID) Process priority Process priority File descriptors File descriptors Pointer to the parent of the process Pointer to the parent of the process Pointers to all children of the process Pointers to all children of the process The processor it is running on The processor it is running on

7 Switching Processes Save the “real world” of the currently active process in process table Save the “real world” of the currently active process in process table Restore the “real world” from the process table of the selected process (the one to be executed next) Restore the “real world” from the process table of the selected process (the one to be executed next)

8 System Process Tables Process Tables Code Data Stack Process

9 Shared Code The shared code must be re-entrant (ie., it must not modify itself) The shared code must be re-entrant (ie., it must not modify itself) Shared Code Data 1 PCB 1 Data 2 PCB 2

10 Process States Ready Blocked Running Terminate Create SUSPEND CONTINUE SCHEDULE PREEMPT

11 Process States Create Create A process is created by an existing process (parent/child); a process is created by a service, or as a new batch job, or an interactive logon A process is created by an existing process (parent/child); a process is created by a service, or as a new batch job, or an interactive logon Terminate Terminate Normal completion (exit); External completion (forced completion: by operator, by parent); Internal completion (error, time overrun) Normal completion (exit); External completion (forced completion: by operator, by parent); Internal completion (error, time overrun) Schedule Schedule A process is selected out of the ready queue (is scheduled) and dispatched to the running state A process is selected out of the ready queue (is scheduled) and dispatched to the running state Preempt Preempt The running process is preempted because some other process of higher priority has become ready (or it yields) The running process is preempted because some other process of higher priority has become ready (or it yields)

12 Process States Suspend Suspend A process starts a time consuming IO operation, or is swapped out, or makes a spontaneous request to sleep, or is blocked in a synchronization operation. When a process is suspended, it is on some queue, namely the queue of all the processes waiting for the same resource. Processes during their life move from queue to queue, with stays in the running state A process starts a time consuming IO operation, or is swapped out, or makes a spontaneous request to sleep, or is blocked in a synchronization operation. When a process is suspended, it is on some queue, namely the queue of all the processes waiting for the same resource. Processes during their life move from queue to queue, with stays in the running state Continue Continue The inverse of Suspension: the resource requested becomes available (timer, IO completes, unblocking) The inverse of Suspension: the resource requested becomes available (timer, IO completes, unblocking)

13 How to Create New Processes? Fork & Exec fork fork create a new process that is a copy of current one create a new process that is a copy of current one exec exec change the program that a process is executing change the program that a process is executing Some systems combine the two into one Some systems combine the two into one

14 A Simple Shell void main() { int child; if ( (child = fork())==-1 ) return( -1 ); return( -1 );else if ( child==0 ) { printf( "This is the child executing\n"); exit(1);} printf( "This is the parent\n" ); }

15 Parent Child Relationship root is the parent root is the parent p1, p2 and p3 are children of root process p1, p2 and p3 are children of root process p4 and p5 are children of p3 p4 and p5 are children of p3 root p5 p3 p4 p2 p1