I am trying to restart a python process using multiprocessing module, but "AssertionError: cannot start a process twice" appears.
My question
- How can I restart the process
- Once its terminated why it is going to zombie mod
- How can I remove the zombie process
import time
from multiprocessing import Process
def worker ():
while True:
print "Inside the worker"
time.sleep(10)
p1 = Process(target=worker,name="worker")
p1.start()
#p1.join()
time.sleep(3)
p1.terminate()
print "after Termination "
time.sleep(3)
p1.start()
Actually I am trying to create a process monitor function to watch the memory and CPU usage of all processes . If it reach a certain level I want to restart on realtime