Solving the problem of mutual recursion
Ian Kelly
ian.g.kelly at gmail.com
Mon May 27 03:04:26 EDT 2013
On Mon, May 27, 2013 at 12:19 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> 7) Since the program being tested does basically nothing except start
> and exit threads, the extra 40% probably represents the overhead of
> all that starting and stopping, which would be done outside the GIL.
To test this, I tried running the script in Python 2.7 in Linux with
the print statements removed and verified that it was using about 135%
of the CPU. However, top also told me that only about 95% of that was
user processes; the other 40% was kernel usage. The 40% doesn't seem
to be threading overhead though, because I tried adding large xrange
loops to slow down the thread creation process and it had no effect on
the stats.
Then I tried running the same program in Python 3.2, and I got the
more expected 100% CPU usage with minimal kernel time. So I'm
thinking now that the extra 40% may actually be overhead induced by
the GIL. If that's the case then wow, the old GIL really did suck.
More information about the Python-list
mailing list