Operations On Processes
Operations On Processes
CS8493-OPERATING SYSTEMS
ROHINI COLLEGE OF ENGINEERING & TECHNOLOGY
The sshd process is responsible for managing clients that connect to the system by
using ssh(Secure shell)
The login process is responsible for managing clients that directly log onto the system
The command ps –el will list complete information for all processes currently active in
the system.
When a process creates a new process, two possibilities for execution exist:
The parent continues to execute concurrently with its children.
The parent waits until some or all of its children have terminated
There are also two address-space possibilities for the new process:
The child process is a duplicate of the parent process (it has the same program as the
parent).
The child process has a new program loaded into it.
The return code for the fork() is zero for the new (child) process, whereas the
(nonzero) process identifier of the child is returned to the parent.
o After a fork() system call, one of the two processes typically uses the exec()
system call to replace the process’s memory space with a new program.
o A new process is created by the fork() system call. The new process consists of
a copy of the address space of the original process. This mechanism allows the
parent process to communicate easily with its child process.
CS8493-OPERATING SYSTEMS
ROHINI COLLEGE OF ENGINEERING & TECHNOLOGY
A process terminates when it finishes executing its final statement and asks the
operating system to delete it by using the exit() system call.
At that point, the process may return a status value (typically an integer) to its parent
process.
All the resources of the process—including physical and virtual memory, open files,
and I/O buffers—are deallocated by the operating system
CS8493-OPERATING SYSTEMS
ROHINI COLLEGE OF ENGINEERING & TECHNOLOGY
A parent may terminate the execution of one of its children for a variety of reasons,
such as
The child has exceeded its usage of some of the resources that it has been allocated.
The task assigned to the child is no longer required.
The parent is exiting, and the operating system does not allow a child to continue if its
parent terminates.
Some systems do not allow a child to exist if its parent has terminated. In such systems,
if a process terminates (either normally or abnormally), then all its children must also
be terminated. This phenomenon is referred to as cascading termination.
A parent process may wait for the termination of a child process by using the wait()
system call
This system call also returns the process identifier of the terminated child so that the
parent can tell which of its children has terminated:
pid t pid;
int status;
pid = wait(&status);
o A process that has terminated, but whose parent has not yet called wait(), is
known as a zombie process.
CS8493-OPERATING SYSTEMS