Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #56686

Re: Multi-threading in Python vs Java

From Piet van Oostrum <piet@vanoostrum.org>
Newsgroups comp.lang.python
Subject Re: Multi-threading in Python vs Java
Date 2013-10-11 10:55 -0400
Message-ID <m2eh7rsvpr.fsf@cochabamba.vanoostrum.org> (permalink)
References <46669eab-49f4-4daf-a410-abfbe9e87fc3@googlegroups.com> <6d35b728-85c2-4fc0-bbc8-6c033bdfcfb0@googlegroups.com> <mailman.996.1381481315.18130.python-list@python.org>

Show all headers | View raw


Chris Angelico <rosuav@gmail.com> writes:

> On Fri, Oct 11, 2013 at 7:41 PM, Peter Cacioppi
> <peter.cacioppi@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@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Multi-threading in Python vs Java Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-10 23:01 -0700
  Re: Multi-threading in Python vs Java Cameron Simpson <cs@zip.com.au> - 2013-10-11 17:53 +1100
    Re: Multi-threading in Python vs Java Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-11 09:30 +0000
  Re: Multi-threading in Python vs Java Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-11 01:41 -0700
    Re: Multi-threading in Python vs Java Chris Angelico <rosuav@gmail.com> - 2013-10-11 19:48 +1100
      Re: Multi-threading in Python vs Java Piet van Oostrum <piet@vanoostrum.org> - 2013-10-11 10:55 -0400
    Re: Multi-threading in Python vs Java Terry Reedy <tjreedy@udel.edu> - 2013-10-11 15:53 -0400
  Re: Multi-threading in Python vs Java Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-11 13:10 -0700

csiph-web