# creating and demonstrating an orphan process
# import module os.
import os
import time
id = os.fork()

if (id==0):
# this is the child
   parent = os.getppid()
   for j in range(7):
	time.sleep(1)
	cid=os.getppid()
	print "Child: My parent"\
              "is process ID ", cid
	if (parent <> cid):
	   print "I just became an orphan"
	   parent=cid
else:
   time.sleep(3)

#################################################################################
