Operating Systems Processes 1.

Slides:



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

1 CS345 Operating Systems Φροντιστήριο Άσκησης 1.
Pertemuan 13 Threads Matakuliah: H0483 / Network Programming Tahun: 2005 Versi: 1.0.
Operating Systems COMP 4850/CISG 5550 Processes Introduction to Threads Dr. James Money.
Processes & Threads Today Next Time Process concept Process model
Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
The Process Model.
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 Processes and Pipes COS 217 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.
1 CS 333 Introduction to Operating Systems Class 2 – OS-Related Hardware & Software The Process Concept Jonathan Walpole Computer Science Portland State.
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.
CSCE 351: Operating System Kernels
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
Chapter 2 Processes and Threads Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
CSSE Operating Systems
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
Fork and Exec Unix Model Tutorial 3. Process Management Model The Unix process management model is split into two distinct operations : 1. The creation.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S. TANENBAUM ALBERT S. WOODHULL Yan hao (Wilson) Wu University of the Western.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Processes Tarek Abdelzaher Vikram Adve.
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.
Process. Processes A process is an abstraction for sequence of operations that implement a computation/program. A process may be manipulated, suspended,
Operating Systems Chapter 2
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 2 Processes and Threads Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Creating and Executing Processes
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
CSC 360- Instructor: K. Wu Processes. CSC 360- Instructor: K. Wu Agenda 1.What is a process? 2.Process states 3. PCB 4.Context switching 5.Process scheduling.
Computer Studies (AL) Operating System Process Management - Process.
System calls for Process management
Process Models, Creation and Termination Reference –text: Tanenbaum ch. 2.1.
2.1 Processes  process = abstraction of a running program.
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.
Tutorial 3. In this tutorial we’ll see Fork() and Exec() system calls.
System calls for Process management Process creation, termination, waiting.
2.1 Processes  process = abstraction of a running program  multiprogramming = CPU switches from running program to running program  pseudoparallelism.
CS241 Systems Programming Discussion Section Week 2 Original slides by: Stephen Kloder.
1 Unix system calls fork( ) wait( ) exit( ). 2 How To Create New Processes? n Underlying mechanism -A process runs fork to create a child process -Parent.
CS241 Systems Programming Discussion Section Week 2 Original slides by: Stephen Kloder.
Unix Process Management
Chapter 3: Processes.
Processes A process is a running program.
Processes in Unix, Linux, and Windows
Example questions… Can a shell kill itself? Can a shell within a shell kill the parent shell? What happens to background processes when you exit from.
Chapter 3: Processes.
Processes in Unix, Linux, and Windows
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Fork and Exec Unix Model
Process Models, Creation and Termination
More examples How many processes does this piece of code create?
Processes in Unix, Linux, and Windows
2.1 Processes process = abstraction of a running program
Module 2.1 COP4600 – Operating Systems Richard Newman
Chapter 3: Processes.
Tutorial 3 Tutorial 3.
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Jonathan Walpole Computer Science Portland State University
Lecture 6: Multiprogramming and Context Switching
Processes in Unix, Linux, and Windows
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
Process Management -Compiled for CSIT
Process Management -Compiled for CSIT
Presentation transcript:

Operating Systems Processes 1

Objectives What’s process? What’s the difference between program and process? What about process’s lifecycle?

The Process Model (a) Multiprogramming of four programs. (b) Conceptual model of four independent, sequential processes. (c) Only one program is active at once.

Process A process consists of three parts: What’s process? A process is an instance of a computer program that is being executed. It contains the program code and its current activity. What is the difference between program and process? Program is just the static text . Process is an dynamic entity being executed and has lifecycle. A process consists of three parts: Process Control Block ( Process Table Entry) Program (Text) Data

Processes Control Block Some of the fields of a typical process table entry.

Process Hierarchies Parent creates a child process, child processes can create its own process Forms a hierarchy UNIX calls this a "process group" Windows has no concept of process hierarchy all processes are created equal

Process Creation Events which cause process creation: System initialization. Execution of a process creation system call by a running process. A user request to create a new process. Initiation of a batch job.

fork main() { pid_t val; printf("PID before fork(): %d \n",(int)getpid()); val=fork(); if ( val > 0) { printf("Parent PID: %d\n",(int)getpid()); } else if (val == 0) { printf("Child PID: %d\n",(int)getpid()); } else { printf(“Fork failed!”); exit(1); }

Shell and its children All processes are started by other processes Parent/Child relationship $ ls –l A process can be terminated for two reasons: The process terminates itself when done. The process is terminated by a signal from another process. bash fork() exec() ls -l exit()

Code pid_t val; int exit_code = 0; val=fork(); if (val > 0) { int stat_val; pid_t child_pid; child_pid = waitpid(val,&stat_val,0); printf("Child has finished: PID = %d\n", child_pid); if(WIFEXITED(stat_val)) printf("Child exited with code %d\n", WEXITSTATUS(stat_val)); else printf("Child terminated abnormally\n"); exit(exit_code); } else if (val == 0) { execlp("ls","ls","-l",NULL); }

The life of a process

Process States A process can be in running, blocked, or ready state. Transitions between these states are as shown.

Scheduling The lowest layer of a process-structured operating system handles interrupts and scheduling. Above that layer are sequential processes.

Process Termination Events which cause process termination: Normal exit (voluntary). Error exit (voluntary). Fatal error (involuntary). Killed by another process (involuntary).

Implementation of Processes (3) Skeleton of what the lowest level of the operating system does when an interrupt occurs.

Modeling Multiprogramming CPU utilization as a function of the number of processes in memory.

Summary Pseudo-parallelism vs. multiprocessor Program vs. process Process Hierarchies Process lifecycle Process states System Calls: fork() vfork() execl() execv() execle() execve() execlp() execvp() wait() waitpid() exit() system()