Create a child process and display process id of both parent and child process.
Fork system call use for creates a new process, which is called child process, which runs concurrently with process (which process called system call fork) and this process is called parent process. After a new child process created, both processes will execute the next instruction following the fork() system call.
Library used :
os : The OS module in Python provides a way of using operating system dependent functionality. The functions that the OS module provides allows you to interface with the underlying operating system that Python is running on; be that Windows, Mac or Linux. It can be imported as –
System Call Used :
Below is Python program implementing above :
Child process and id is : 32523 Parent process and id is : 32524
Note : Output can vary time to time, machine to machine or process to process.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.