ADVERTISEMENT
ADVERTISEMENT

Home » Operating Systems

Child process in Operating System

Child process in OS: In this tutorial, we are going to learn what the significance of child process is?
Submitted by Monika Jha, on September 19, 2019

Child process

One process can create another process, this methodology involves in multitasking Operating System. Here, the process creates another process is called the parent process and the created process is referred to as the child process.

Child process is the subprocess of the main process.

There are two approaches for creating a child process:

  1. By using the fork system call (favorable for Unix- like systems and the POSIX standard).
  2. By using the spawn (modern kernel of Microsoft Window).

1) Child created by fork system call

Most of the features of the parent process come into its child process.

For example, file descriptors come into subprocess (child process) from its parent.

In the Unix system, a child process is referred to as the copy of its parent, using the fork system call.

After child process has created, it can be laminated with a different program (using exec system call) as per the requirement.

2) By using the spawn

Spawn is a method by which we can load and execute a new child process. Currently, the running process can wait for the subprocess bring to an end or it can continue on its job.

Any process that is new to the system it requires sufficient memory space that's why parent and its subprocess can execute without any interruption.

Is there any limit to create child process?

Each process can create many sub-processes but each and every child process must have a parent process. If ant process does not have a parent so this indicates it was directly created by the kernel.

In different systems the first process which is init created by the kernel at the time of booting and this kernel created process never terminates.

Some processes which has no parent may be created to carry out various daemon tasks in user space. A way by which a process end up is death (end) of its parent. It leaves its child as a orphan process and with the sum up this process is adopted by init process.

When a child process exits a signal SIGCHLD is sent to the parent of a child process, is interrupted, or resumes after being interrupted. By default the signal is simply ignored.

End of a child process

When a child process ends up its execution or terminates, some data is go back to its parent process.

Whenever a child process ends its execution before the parent has called wait, the kernel has save some information regarding the main process, such as exit status of child, to enable its parent process to call wait later. Because the child is still system resources but not executing it. Such type of process is known as a zombie process. The wait system call is generally held in the SIGCHLD handler.

ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.