Lab 5 Process Control Operating System Lab.

Slides:



Advertisements
Similar presentations
3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Process An operating system executes a variety of programs: Batch system.
Advertisements

Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Objectives Understand Process concept Process scheduling Creating.
Chapter 3: Processes.
NCHU System & Network Lab Lab 12 Page Replacement Algorithm.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
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.
CMPT 300: Operating Systems I Ch 3: Processes Dr. Mohamed Hefeeda
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
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.
Process Concept An operating system executes a variety of programs
BINA RAMAMURTHY UNIVERSITY AT BUFFALO System Structure and Process Model 5/30/2013 Amrita-UB-MSES
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Chapter 3 Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
Process by Dr. Amin Danial Asham. References Operating System Concepts ABRAHAM SILBERSCHATZ, PETER BAER GALVIN, and GREG GAGNE.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
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.
Linux Processes Travis Willey Jeff Mihalik. What is a process? A process is a program in execution A process includes: –program counter –stack –data section.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
3.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Overview: Process Concept Process Scheduling Operations on Processes.
Process Management Azzam Mourad COEN 346.
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.
NCHU System & Network Lab Lab #6 Thread Management Operating System Lab.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
A process is a program in execution A running system consists of multiple processes – OS processes Processes started by the OS to do “system things” –
Chapter 3: Processes.
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Linux Processes & Threads
Process Management Presented By Aditya Gupta Assistant Professor
Unix Process Management
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.
Processes in Unix, Linux, and Windows
System Structure and Process Model
Chapter 3: Processes.
System Structure and Process Model
Processes in Unix, Linux, and Windows
Lecture 2: Processes Part 1
System Structure B. Ramamurthy.
EECE.4810/EECE.5730 Operating Systems
Processes in Unix, Linux, and Windows
System Structure and Process Model
Process & its States Lecture 5.
Chapter 3: Processes.
Process Creation Process Termination
Chapter 3: Processes.
Processes in Unix, Linux, and Windows
Processes in Unix and Windows
Lab 10 Paging.
Outline Chapter 2 (cont) Chapter 3: Processes Virtual machines
EECE.4810/EECE.5730 Operating Systems
Chapter 3: Process Concept
EECE.4810/EECE.5730 Operating Systems
EECE.4810/EECE.5730 Operating Systems
EECE.4810/EECE.5730 Operating Systems
Lab #9 Semaphores Operating System Lab.
Presentation transcript:

Lab 5 Process Control Operating System Lab

NCHU System & Network Lab What is a process? Informally, a process is a program in execution. A process includes data section, which contains global variables text section, which contains the program code stack section, which contains temporary data heap section, which contains dynamically allocated memory A process is more than the program code, it also includes the current activity Represented by the value of the program counter and the contents of the processor’s registers. NCHU System & Network Lab

NCHU System & Network Lab Process Creation Parent process create children processes, which, in turn create other processes, forming a tree of processes. NCHU System & Network Lab

Process Creation (cont.) Resource sharing Parent and children share all resources Children share subset of parent’s resources Parent and child share no resources Execution Parent and children execute concurrently Parent waits until children terminate Address space Child duplicate of parent Child has a program loaded into it NCHU System & Network Lab

Process Identification UNIX identifies processes by a unique integral value called the process ID. Each process also has a parent process ID, which is initially the process ID of the process that created it. NCHU System & Network Lab

NCHU System & Network Lab The fork() Function UNIX examples fork() system call creates new process The fork() copies the parent's memory image so that the new process receives a copy of the address space of the parent. Both processes continue at the instruction after the fork statement (executing in their respective memory images). NCHU System & Network Lab

The fork() Function (cont.) Memory Copy from original image Original image fork() New image NCHU System & Network Lab

The fork() Function (cont.) NCHU System & Network Lab

The fork() Function (cont.) NCHU System & Network Lab

NCHU System & Network Lab The wait() Function The parent can execute wait() to block until the child finishes. If wait() returns because the status of a child is reported, it returns the process ID of that child. Else if an error occurs, it returns –1. NCHU System & Network Lab

NCHU System & Network Lab The exec() Family The fork() function creates a copy of the calling process, but many applications require the child process to execute code that is different from that of the parent. The exec() family provides a facility for overlaying the process image of the calling process with a new image. Use the fork()–exec() combination for the child to execute the new program while the parent continues to execute the original code. NCHU System & Network Lab

The exec() Family (cont.) Memory Copy from original image Original image fork() Load another image New image exec() NCHU System & Network Lab

The exec() Family (cont.) execlp passes the command-line arguments in an explicit list and are useful if you know the number of command-line arguments at compile time. Example execlp ("/bin/ls", "ls", “-l” , NULL); NCHU System & Network Lab

C Program Forking a Child Process

NCHU System & Network Lab Lab I Create a child process Increases the value of a global variable Declare a local variable and increase its value Note that, both the global and local variables must be initialized and have the same values. Finally, both of the processes print their results of global and local variables and also show their process id and parent’s id. NCHU System & Network Lab

NCHU System & Network Lab Lab II Write a program that creates 5 processes, forming a tree configuration illustrated in the figure. Prints their own reports to show their process id and their parent’s id Make a number of wait() for all it’s children exiting. Depend on the number of children A B C D E NCHU System & Network Lab

NCHU System & Network Lab References Avi Silberschatz, Peter Baer Galvin and Greg Gagne, “Operating System Concepts,” John Wiley & Sons, 6th Edition, 2001 “Unix Systems Programming: Communication, Concurrency, and Threads” by Kay A. Robbins, Steven Robbins Neil Matthew and Richard Stones, “Beginning Linux Programming,” Wiley publishing, 3rd Edition, 2004 W. Richard Stevens, “Advanced Programming in the UNIX Environment,” Addison-Wesley, 1992 NCHU System & Network Lab