Why GIL? (was Re: what's the point of rpython?)

Carl Banks pavlovevidence at gmail.com
Sat Jan 24 02:44:31 EST 2009


On Jan 23, 10:55 pm, Bryan Olson <fakeaddr... at nowhere.org> wrote:
> Carl Banks wrote:
> > Paul Rubin wrote:
> >> Bryan Olson writes:
> >>>> BTW, class instances are usually immutable and thus don't require a
> >>>> mutex in the system I described.
> >>> Then you are describing a language radically different from Python.
> >> That one threw me for a minute too, but I think the idea is that the
> >> class instance itself is immutable, while its slots (specifically the
> >> attribute dictionary) point to mutable objects.
>
> > Correct, and, getting back to the point, an instance itself would not
> > require a mutex.  The dict would need it, of course.
>
> The dict is part of the object and some important slots are mutable.
> What's more, if your point was to do away with the GIL without changing
> Python semantics nor requiring heaping masses of locking, I fear you've
> not fully grasped the problem.

If that's what you think I thought, I fear you haven't read anything
I've written.

[snip]
> An object's __dict__ slot is *not* mutable; thus we could gain some
> efficiency by protecting the object and its dict with the same lock. I
> do not see a major win in Mr. Banks' point that we do not need to lock
> the object, just its dict.

I'm not sure where you got the idea that I was claiming this was a
major win.  I'm not sure where you got the idea that I claimed that
having to lock all mutable objects wouldn't be slow.  For Pete's sake,
you followed up to a post where I *agreed* that it would be slow.


Carl Banks



More information about the Python-list mailing list