I am new to multiprocessing, and am trying to use the multiprocessing.Process class instead of the threading.Thread class for a project since they apparently have the same variables, however even though I copied this code, the run() does not seem to work… could this have to do with the python version or missing files?
import multiprocessing
class Worker(multiprocessing.Process):
def run(self):
print 'In %s' % self.name
return
if __name__ == '__main__':
jobs = []
for i in range(5):
p = Worker()
jobs.append(p)
p.start()
for j in jobs:
j.join()
I have found other examples but still don’t understand this, please help.
It’s because of the differences between the multiprocessing and threading modules. This question is basically identical to Child processes created with python multiprocessing module won't print