Process Models, Creation and Termination

Slides:



Advertisements
Similar presentations
1 Processes and Threads Creation and Termination States Usage Implementations.
Advertisements

3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Process An operating system executes a variety of programs: Batch system.
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.
Thursday, June 08, 2006 The number of UNIX installations has grown to 10, with more expected. The UNIX Programmer's Manual, 2nd Edition, June, 1972.
1 What is a Process ? The activity of program execution. Also called a task or job Has associated with it: Code Data Resources A State An executing set.
Review: Operating System Manages all system resources ALU Memory I/O Files Objectives: Security Efficiency Convenience.
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.
Chapter 2 Processes and Threads Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
OPERATING SYSTEM LESSON 4 PROCESS.
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S. TANENBAUM ALBERT S. WOODHULL Yan hao (Wilson) Wu University of the Western.
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Processes and Threads.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 2 Processes and Threads Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Operating Systems Processes 1.
Silberschatz, Galvin and Gagne  Operating System Concepts Process Concept An operating system executes a variety of programs:  Batch system.
Process Models, Creation and Termination Reference –text: Tanenbaum ch. 2.1.
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.
Operating Systems Process Creation
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
2.1 Processes  process = abstraction of a running program.
CS 390 Unix Programming Environment
2 Processor(s)Main MemoryDevices Process, Thread & Resource Manager Memory Manager Device Manager File Manager.
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
Processes and Threads MICROSOFT.  Process  Process Model  Process Creation  Process Termination  Process States  Implementation of Processes  Thread.
2.1 Processes  process = abstraction of a running program  multiprogramming = CPU switches from running program to running program  pseudoparallelism.
1 Lecture 19: Unix signals and Terminal management n what is a signal n signal handling u kernel u user n signal generation n signal example usage n terminal.
Processes and threads.
Process Management Process Concept Why only the global variables?
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
Process Management Presented By Aditya Gupta Assistant Professor
Unix Process Management
Operating Systems: A Modern Perspective, Chapter 6
Chapter 3: Processes.
O/S State Diagrams © 2004, D. J. Foreman.
Process and Thread State Diagrams
Processes A process is a running program.
Processes in Unix, Linux, and Windows
System Structure and Process Model
Chapter 3: Processes.
System Structure and Process Model
MODERN OPERATING SYSTEMS Third Edition ANDREW S
System Structure B. Ramamurthy.
Processes in Unix, Linux, and Windows
2.1 Processes process = abstraction of a running program
Module 2.1 COP4600 – Operating Systems Richard Newman
CHAPTER 8 ( , ) John Carelli, Instructor Kutztown University
Process & its States Lecture 5.
Chapter 3: Processes.
Operating System Concepts
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Process and Thread State Diagrams
Chapter 3: Processes.
CSE 451: Operating Systems Winter 2003 Lecture 4 Processes
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Implementing Processes, Threads, and Resources
Processes in Unix and Windows
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Processes – Part I.
CS510 Operating System Foundations
Outline Process Management Process manager Hardware process
Process Management -Compiled for CSIT
Implementing Processes, Threads, and Resources
Process and Thread State Diagrams
Process and Thread State Diagrams
Chapter 3: Process Management
Presentation transcript:

Process Models, Creation and Termination Reference text: Tanenbaum ch. 2.1

Definitions Programs Processes Algorithms embodied in machine code usually stored in an executable file Processes Programs in execution Includes CPU and memory usage Sequential process uses a single program counter showing where the CPU is in the code

fork Example revisited int main() { if (fork()) printf(“hello from parent\n”); else printf(“hello from child\n”); /* other program statements */ } 2 processes running the same program

Multiprogramming a) Multiprogramming of 4 programs b) Conceptual model of 4 independent processes c) Only 1 program is active at once

Process Creation Four events cause processes to be created(fork, CreateProcess): 1. System initialization At system bootup time, the kernel is started. 2. Execution of a process-create system call A running process can issue system calls 3. A user request to create a process Clicking an icon or typing command can start a process 4. Initiation of a batch job Mainframe computers create a new process when starting each batch job

Process Termination Terminate new processes due to: 1. Normal exit(voluntary) terminate at work completion(exit, ExitProcess) 2. Error exit(voluntary) terminate when process discovers a fatal error 3. Fatal error(involuntary) terminate when an error caused by the process(e.g. divide by zero) 4. Killed by another process(involuntary) terminate by another process executing a system call(kill, TerminateProcess)

Process State Codes Show Process State Codes using man ps : Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process: D uninterruptible sleep (usually IO) R running or runnable (on run queue) S interruptible sleep (waiting for an event to complete) T stopped, either by a job control signal or because it is being traced W paging (not valid since the 2.6.xx kernel) X dead (should never be seen) Z defunct ("zombie") process, terminated but not reaped by its parent For BSD formats and when the stat keyword is used, additional characters may be displayed: < high-priority (not nice to other users) N low-priority (nice to other users) L has pages locked into memory (for real-time and custom IO) s is a session leader l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do) + is in the foreground process group

Zombies If a process exits in UNIX and its parent does not pick up its exit status. Not using resources Show up with “Z” in the process state “S” column when using a “ps -ux” command Stay in system until reboot To avoid zombies, make the parent process do a wait or waitpd to pick up the status.

Process Hierarchies In UNIX, a parent process and all its children and further descendants form a process group A user signal is delivered to all members of a process group where each process handles accordingly No process hierarchy in Windows, but one process can control another via its process handle Special Control-C handling for console apps

mtip Example shell Mtip doing keymon Mtip doing linemon Wait for child termination User issues control-C SIGINT Mtip doing keymon Wait for read from user SIGINT Mtip doing linemon Wait for read from line to SAPC

Process States Possible process states: Transition between states Running Blocked Ready Transition between states

Example of Changing Process States Process A: CPU-bound the whole time Process B: about to read from user, block, eventually unblock Process C: about to write a large file to disk, block on output, eventually unblock

Changing Process States (cont’d) ch input int disk Process A Process B Process C Key: running ready blocked a b c d e f g h i j k running a: preempt A, schedule B f: int for disk write, not done b: block B, schedule A g: int for char input, done c: preempt A, schedule C h: preempt A, schedule B d: block C, schedule A i: block B, schedule A e: int for char input, not done j: int for disk write done, C ready k: preempt A, schedule C

Changing Process States (cont’d) Interrupts ride on the currently-running process Interrupt handler execution between two instructions of the currently-running process The interrupt handler is kernel code and uses only kernel data, and purposely ignores data in the current process. When process A is running, process A’s data is loaded in the user memory. Process A is interrupted when a char for process B is received. The interrupt handler processes the incoming data using kernel data. This is typical - each process is bombarded with interrupts for other processes’ data, - process is usually blocked during the time when interrupts for its own data come in.