Process Concepts
Process Concepts
Process
Parent process Child process
spawning
• when the OS • is the original, • is the new
creates a creating, process
process at the process
explicit request
of another
process
The above figure illustrates a typical process tree for the Linux
operating system, showing the name of each process and its pid.
MSc CS 2020 Batch - BY JK
Process Creation
• The systemd process (which always has a pid of 1) serves as the root parent
process for all user processes, and is the first user process created when the
system boots.
• Once the system has booted, the systemd process creates processes which provide additional
services such as a web or print server, an ssh server, and the like.
• Two children of systemd—logind and sshd.
• The logind process is responsible for managing clients that directly log onto the system.
• In this example, a client has logged on and is using the bash shell, which has been assigned
pid 8416.
• Using the bash command-line interface, this user has created the process ps as well as the
vim editor.
• The sshd process is responsible for managing clients that connect to the system by using ssh
(which is short for secure shell).
forkresult=fork();
if(forkresult==-1)
{
printf("Fork failed\n");
exit(0);
}
• Although the details will differ from one OS to another, fundamentally, all
operating systems maintain information in these four categories.
• Finally, the OS may be activated by a supervisor call from the program being
executed.
• For example, a user process is running and an instruction is executed that requests an I/O
operation, such as a file open.
• This call results in a transfer to a routine that is part of the operating system code.
The use of a system call may place the user process in the Blocked state.
MSc CS 2020 Batch - BY JK
Different Kinds of Interrupts
• Clock Interrupt
• The OS determines whether the currently running process has been executing
for maximum allowable unit of time referred to as time slice. If so, this
process must be switched to a ready state and another process dispatched.
• I/O Interrupt
• If the I/O operation completes for which one or more processes are waiting,
then OS moves all those processes from blocked state to ready state. Then OS
may continue with currently running process or schedule another high
priority process that has been unblocked.