[Python-Dev] Re: marking shared-ness

Greg Stein gstein@lyra.org
Wed, 26 Apr 2000 06:00:21 -0700 (PDT)


On Tue, 25 Apr 2000, Tim Peters wrote:
> [Greg Stein]
> > ...
> > Many people have asked for free-threading, and the number of inquiries
> > that I receive have grown over time. (nobody asked in 1996 when I first
> > published my patches; I get a query every couple months now)
> 
> Huh!  That means people ask me about it more often than they ask you <wink>.
> 
> I'll add, though, that you have to dig into the inquiry:  almost everyone
> who asks me is running on a uniprocessor machine, and are really after one
> of two other things:
> 
> 1. They expect threaded stuff to run faster if free-threaded.  "Why?" is
>    a question I can't answer <0.5 wink>.

Heh. Yes, I definitely see this one. But there are some clueful people out
there, too, so I'm not totally discouraged :-)

> 2. Dealing with the global lock drives them insane, especially when trying
>    to call back into Python from a "foreign" C thread.
> 
> #2 may be fixable via less radical means (like a streamlined procedure
> enabled by some relatively minor core interpreter changes, and clearer
> docs).

No doubt. I was rather upset with Guido's "Swap" API for the thread state.
Grr. I sent him a very nice (IMO) API that I used for my patches. The Swap
was simply a poor choice on his part. It implies that you are swapping a
thread state for another (specifically: the "current" thread state). Of
course, that is wholly inappropriate in a free-threading environment. All
those calls to _Swap() will be overhead in an FT world.

I liked my "PyThreadState *PyThreadState_Ensure()" function. It would
create the sucker if it didn't exist, then return *this* thread's state to
you. Handy as hell. No monkeying around with "Get. oops. didn't exist.
let's create one now."

> I'm still a fan of free-threading!  It's just one of those things that may
> yield a "well, ya, that's what I asked for, but turns out it's not what I
> *wanted*" outcome as often as not.

hehe. Damn straight. :-)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/