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.
- Calculation in parent and child process using fork()
- Creating multiple process using fork()
- Communication between Parent and Child process using pipe in Python
- Run Python script from Node.js using child process spawn() method
- Exit status of a child process in Linux
- PyQt5 QSpinBox - Finding child using child type
- Python | Creating a 3D List
- Python | Catching and Creating Exceptions
- Creating a Proxy Webserver in Python | Set 2
- Creating a Proxy Webserver in Python | Set 1
- Creating linear kernel SVM in Python
- Python | Creating Multidimensional dictionary
- Python | Creating a button in tkinter
- Creating NotePad using PyQt5 - Python
- Python | os.fork() method
- Python: Pillow (a fork of PIL)
- Python | Creating tensors using different functions in Tensorflow
- Python | Creating a Simple Drawing App in kivy
- Creating Tabbed Widget With Python-Tkinter
- Python | Creating DataFrame from dict of narray/lists
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.