Skip to content Skip to sidebar Skip to footer

Parallel Processing On Python

I am a beginner in python and multiprocessing so if the question seems naive please forgive me. I have two functions that I want to run at the same time. One is an openCV implemen

Solution 1:

I use the multiprocessing module for running two functions parallel. For what I did (changed to your situation):

import multiprocessing

def main():
    does(s) # a function call 

def face():
    recog.main() #another call

# Initiate two workers for the two functions
workerMAIN = multiprocessing.Process(target=main)
workerFACE = multiprocessing.Process(target=face)

# Start the workers
workerMAIN.start()
workerFACE.start()

# Wait until the functions have finished
workerMAIN.join()
workerFACE.join()

Post a Comment for "Parallel Processing On Python"