Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
Because of un-manageable amounts of spam despite our use of CAPTCHAs, email authorization, and other tools, we have discontinued this forum (see the 700k+ registered users with validated email addresses at right?). Please email us any questions or post bug reports and feature requests on GitHub at https://github.com/jevois -- The content below remains available for future reference.

Python multi-threading

0 votes
I am looking for examples of how to set up a multi-threaded Module in Python.

I would like to process the same image by two completely separate processes.

There is a good tutorial for C++11, but nothing I could find for Python.
asked Jan 13, 2018 in Programmer Questions by Billbo911 (1,110 points)
edited Jan 14, 2018 by Billbo911

1 Answer

0 votes

Good question! My initial guess was to just use the python module “threading” but further reading seems to imply that this will not allow you to truly parallelize over multiple cores because of limitations of the python global interpreter lock. So it seems that threads are a no go in python generally, if your goal is concurrent execution of several algorithms. Process-level parallelism looks like an option then, with resources here for example:

https://wiki.python.org/moin/ParallelProcessing

The “multiprocessing” module, in particular, is included in python 3. We have not tested this ln jevois yet, will try asap. I see no reason why jevois-daemon would have issues with a fork() approach but we never know.

answered Jan 15, 2018 by JeVois (46,580 points)
...