Multi-threading in Python vs Java

Piet van Oostrum piet at vanoostrum.org
Fri Oct 11 10:55:44 EDT 2013


Chris Angelico <rosuav at gmail.com> writes:

> On Fri, Oct 11, 2013 at 7:41 PM, Peter Cacioppi
> <peter.cacioppi at gmail.com> wrote:
>> So, my hope is that the GIL restrictions won't be problematic here. That is to say, I don't need **Python** code to ever run concurrently. I just need Python to allow a different Python worker thread to execute when all the other worker threads are blocking on the model.solve() task. Once the algorithm is in full swing, it is typical for all the worker threads should be blocking on model.Solve() at the same time.
>
> Sounds like Python will serve you just fine! Check out the threading
> module, knock together a quick test, and spin it up!

But it only works if the external C library has been written to release
the GIL around the long computations. If not, then the OP could try to
write a wrapper around them that does this.
-- 
Piet van Oostrum <piet at vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]



More information about the Python-list mailing list