process

process - The Process Understanding the Process A process...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
The Process
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Understanding the Process A process is defined as an instance of a running program. A process lives as long as the program is running. The kernel makes sure that processes get their due time slice and are swapped out to disk as and when needed. A process is identified by the process identifier (PID).
Background image of page 2
Understanding the Process A process has the following attributes: The real user-id of the user who created the process. The user is said to be the owner of the process. The real group-id of the owner process. Both user-id and group-id of the owner are stored in / etc/passwd. The priority with which it runs. The current directory from where the process was run. A process is said to be born when the program starts execution.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Understanding the Process After execution is complete, the process is said to die . Every process has a parent identified by the parent process identifier (PPID) except the ancestry of every process - the first process (PID 0) which is set up when the system is booted. A process can spawn (generate) multiple children.
Background image of page 4
How a Process Is Created Every process comprises code and data. The process image as viewed by the kernel runs in its own user address space . This address space has a number of segments: Text Segment – This contains the executable code of a program. Data Segment – All variables and arrays the program uses are held here. User Segment – This contains all the process attributes.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
How a Process Is Created There are three distinct phases in the creation of a process, using three important system calls – fork() , exec() and wait() : : Fork A process is created by the parent with the fork system call, which creates a copy of itself. Exec – The parent then overwrites the copy with the exec system call to create the child. Wait – The parent then executes the wait system call to keep waiting for the child process to complete.
Background image of page 6
How a Process Is Created When a process is forked, it inherits the environment of its parent but changes in the child are not made available in the parent. Built-in shell command like pwd and cd don’t fork a separate process. The shell also spawns a separate sub-shell to execute a shell script.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Login Shell: The First User Process When you log on to a UNIX system, the shell process is immediately set up by the kernel. This program may be sh (Bourne shell), csh (C Shell), ksh (Korn shell), or bash (Bourne again shell). The shell maintains a set of variables that are available to the user. The PID of the login shell is stored in the variable $$. It is the parent of all commands and scripts run from the shell.
Background image of page 8
The init Process The parent of all login shells is the init process with PID 1. init forks and execs a
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/15/2011 for the course ECO 2023 taught by Professor Mr.raza during the Summer '10 term at FAU.

Page1 / 63

process - The Process Understanding the Process A process...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online