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.
We have moved to a new forum at http://jevois.usc.edu, please check it out. The forum at jevois.org/qa will not allow new user registrations but is maintained alive for its useful past questions and answers.

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)
...