OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.
All functions in os module raise OSError in the case of invalid or inaccessible file names and paths, or other arguments that have the correct type, but are not accepted by the operating system.
os.fork() method in Python is used to create a child process. This method work by calling the underlying OS function fork(). This method returns 0 in the child process and child’s process id in the parent process.
os.fork() method is available only on UNIX platforms.
Parameter: No parameter is required
Return Type: This method returns an integer value representing child’s process id in the parent process while 0 in the child process.
I am Parent process Process ID: 10793 Child's process ID: 10794 I am child process Process ID: 10794 Parent's process ID: 10793
- Difference between Method Overloading and Method Overriding in Python
- class method vs static method in Python
- Python | next() method
- Python | os.dup() method
- Python | set() method
- Python | os.getpgrp() method
- Python | os.nice() method
- Python | os.ctermid() method
- Python | sympy.crt() method
- Python | isinstance() method
- Python | os.getppid() method
- Python | os.pwrite() method
- Python | os.open() method
- Python | os.pipe() method
- Python | os.setreuid() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.