Skip to content

Instantly share code, notes, and snippets.

@lextoumbourou
Created November 24, 2013 00:51
Show Gist options
  • Save lextoumbourou/7621974 to your computer and use it in GitHub Desktop.
Save lextoumbourou/7621974 to your computer and use it in GitHub Desktop.
from os import fork, getppid
from time import sleep
pid = fork()
if pid == 0: # We're in the child process
print "Child process up in this."
print "My parent is", getppid()
else:
print "Parent here, I just created child", pid
# Sleep for a second to avoid being dropped back to the shell when the parent finishes
sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment