On Aug 18, 4:58 pm, birdsong <david.birds...@gmail.com> wrote: > On Aug 18, 3:18 pm, Derek Martin <c...@pizzashack.org> wrote: > > > > > On Tue, Aug 18, 2009 at 03:10:15PM -0500, Derek Martin wrote: > > > I have some simple threaded code... If I run this > > > with an arg of 1 (start one thread), it pegs one cpu, as I would > > > expect. If I run it with an arg of 2 (start 2 threads), it uses both > > > CPUs, but utilization of both is less than 50%. Can anyone explain > > > why? > > > Ah, searching while waiting for an answer (the e-mail gateway is a bit > > slow, it seems...) I discovered that the GIL is the culprate. > > Evidently this question comes up a lot. It would probably save a lot > > of time on the part of those who answer questions here, as well as > > those implementing solutions in Python, if whoever is maintaining the > > docs these days would put a blurb about this in the docs in big bold > > letters... Concurrency being perhaps the primary reason to use > > threading, essentially it means that Python is not useful for the > > sorts of problems that one would be inclined to solve they way my code > > works (or rather, was meant to). It would be very helpful to know > > that *before* one tried to implement a solution that way... especially > > for solutions significantly less trivial than mine. ;-) > > > Thanks > > > -- > > Derek D. Martinhttp://www.pizzashack.org/ > > GPG Key ID: 0x81CFE75D > > > application_pgp-signature_part > > < 1KViewDownload > > I would still watch that video which will explain a bit more about the > GIL.
Thank you for the video! It's good to know, but it raises lots of other questions in my mind. Lots of examples would have helped. ~Sean -- http://mail.python.org/mailman/listinfo/python-list