Re: [Python-Dev] Removing the GIL (Me, not you!)
Your idea can be combined with the maxint/2 initial refcount for
non-disposable objects, which should about eliminate thread-count updates for them. --
I don't really like the maxint/2 idea because it requires us to differentiate between globals and everything else. Plus, it's a hack. I'd like a more elegant solution if possible. Justin
On Fri, 14 Sep 2007 14:13:47 -0500, Justin Tulloss <tulloss2@uiuc.edu> wrote:
Your idea can be combined with the maxint/2 initial refcount for
non-disposable objects, which should about eliminate thread-count updates for them. --
I don't really like the maxint/2 idea because it requires us to differentiate between globals and everything else. Plus, it's a hack. I'd like a more elegant solution if possible.
It's not really a solution either. If your program runs for a couple minutes and then exits, maybe it won't trigger some catastrophic behavior from this hack, but if you have a long running process then you're almost certain to be screwed over by this (it wouldn't even have to be *very* long running - a month or two could do it on a 32bit platform). Jean-Paul
Jean-Paul Calderone wrote:
On Fri, 14 Sep 2007 14:13:47 -0500, Justin Tulloss <tulloss2@uiuc.edu> wrote:
Your idea can be combined with the maxint/2 initial refcount for
non-disposable objects, which should about eliminate thread-count updates for them. --
I don't really like the maxint/2 idea because it requires us to differentiate between globals and everything else. Plus, it's a hack. I'd like a more elegant solution if possible.
It's not really a solution either. If your program runs for a couple minutes and then exits, maybe it won't trigger some catastrophic behavior from this hack, but if you have a long running process then you're almost certain to be screwed over by this (it wouldn't even have to be *very* long running - a month or two could do it on a 32bit platform).
Could each class define the value to be added to or subtracted from the refcount? We'd only need a bit to store the value (since it would always be zero or one), but the execution time might increase quite a lot if there's no nifty way to conditionally add or subtract one. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Sorry, the dog ate my .sigline
At 3:30 PM -0400 9/14/07, Jean-Paul Calderone wrote:
On Fri, 14 Sep 2007 14:13:47 -0500, Justin Tulloss <tulloss2@uiuc.edu> wrote:
Your idea can be combined with the maxint/2 initial refcount for
non-disposable objects, which should about eliminate thread-count updates for them. --
I don't really like the maxint/2 idea because it requires us to differentiate between globals and everything else. Plus, it's a hack. I'd like a more elegant solution if possible.
It's not really a solution either. If your program runs for a couple minutes and then exits, maybe it won't trigger some catastrophic behavior from this hack, but if you have a long running process then you're almost certain to be screwed over by this (it wouldn't even have to be *very* long running - a month or two could do it on a 32bit platform).
I don't think either of you understand what setting the initial refcount to maxint/2 for global objects in a thread's refcount vector would do. It has /no/ effect on refcounting. It only prevents the refcount from becoming zero for objects that can never be released, but which would always have a zero thread refcount on thread exit, which would cause a useless and frequent thread count decrement for the object. As the object can never be released, its thread count would be initially non-zero, so the thread count won't be made zero when the thread refcount becomes zero. The thread count is shared in the object. The thread refcount is per thread, and should not be shared, even at the physical cache line level, if good performance is desired. When a new thread is created, part of the thread state would be the refcount vector. Hopefully it would mostly be just VM magic, but the initial part of the vector would contain the immortal objects' refcount, and those would be set to maxint/2. Or 1, for that matter. -- ____________________________________________________________________ TonyN.:' <mailto:tonynelson@georgeanelson.com> ' <http://www.georgeanelson.com/>
On Fri, Sep 14, 2007 at 03:30:49PM -0400, Jean-Paul Calderone wrote:
I don't really like the maxint/2 idea because it requires us to differentiate between globals and everything else. Plus, it's a hack. I'd like a more elegant solution if possible.
It's not really a solution either. If your program runs for a couple minutes and then exits, maybe it won't trigger some catastrophic behavior from this hack, but if you have a long running process then you're almost certain to be screwed over by this
You misunderstand - the point of the 'maxint/2' thing isn't to prevent something from happening at all, it's to prevent it from happening *frequently*.
participants (5)
-
Jean-Paul Calderone -
Jon Ribbens -
Justin Tulloss -
Steve Holden -
Tony Nelson