Take a look at this simple python code with Process:
from multiprocessing import Process
import time
def f(name):
    time.sleep(100)
    print 'hello', name
if __name__ == '__main__':
    p = Process(target=f, args=('bob',))
    p.start()#Has to be terminated in 5 seconds
    #p.join()
    print "This Needs to be Printed Immediately"
I guess I am looking for a function like p.start(timeout).
I want to terminate the p process if it has not self-finished in like 5 seconds. How can I do that? There seems to be no such function.
If p.join() is uncommented, the following print line will have to wait 100 seconds and can not be 'Printed Immediately'.But I want it be done immediately so the p.join() has to be commented out.
 
     
     
     
     
     
    