- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Process vs Parent Process vs Child Process
In Operating System, the fork() system call is used by a process to create another process. The process that used the fork() system call is the parent process and process consequently created is known as the child process.
Details about these are given as follows −
A process is an active program i.e a program that is under execution. It is more than the program code as it includes the program counter, process stack, registers, program code etc. Compared to this, the program code is only the text section.
A process changes its state as it executes. This state partially depends on the current activity of a process. The different states that a process is in during its execution are new, ready, running, blocked, terminated.
A process control block is associated with each of the processes. It contains important information about the process it is associated with such as process state, process number, program counter, list of files and registers, CPU information, memory information etc.
All the processes in operating system are created when a process executes the fork() system call except the startup process. The process that used the fork() system call is the parent process. In other words, a parent process is one that creates a child process. A parent process may have multiple child processes but a child process only one parent process.
On the success of a fork() system call, the PID of the child process is returned to the parent process and 0 is returned to the child process. On the failure of a fork() system call, -1 is returned to the parent process and a child process is not created.
A child process is a process created by a parent process in operating system using a fork() system call. A child process may also be called a subprocess or a subtask.
A child process is created as its parent process’s copy and inherits most of its attributes. If a child process has no parent process, it was created directly by the kernel.
If a child process exits or is interrupted, then a SIGCHLD signal is send to the parent process.
A diagram that demonstrates parent and child process is given as follows −
- Running vs Waiting vs Terminated Process
- Process Creation vs Process Termination in Operating System
- Calculation in parent and child process using fork() in C++
- Message Passing vs Shared Memory Process communication Models
- Python program to communicate between parent and child process using the pipe.
- How to get the parent process of the Process API in Java 9?
- Creating child process using fork() in Python
- Resuming Process Monitoring for a Process Instance
- What is Process Suspension and Process Switching?
- Process Management
- Cooperating Process
- Process Scheduling Fundamentals
- Lightweight process (LWP)
- Linux Process Monitoring
- Run Python script from Node.js using child process spawn() method?