Re: SMP, GIL and Threads

2005-12-17 Thread Aahz
In article <[EMAIL PROTECTED]>, catsup <[EMAIL PROTECTED]> wrote: > >It was actually quite a minor adjustment in the application to follow >the oft repeated advice here on this subject to share only the >Queue object between threads. Making the update of the dictionary >just another queued command

Re: SMP, GIL and Threads

2005-12-17 Thread catsup
It was actually quite a minor adjustment in the application to follow the oft repeated advice here on this subject to share only the Queue object between threads. Making the update of the dictionary just another queued command request caused both the dictionary read and write to be performed by th

Re: SMP, GIL and Threads

2005-12-16 Thread Aahz
In article <[EMAIL PROTECTED]>, catsup <[EMAIL PROTECTED]> wrote: > >I have an app written under version Python 2.3.5. The problem I'm >having is that it hangs on one of its threads. The thread that hangs >does updates to a standard dictionary shared with another thread that >only reads this dict

Re: SMP, GIL and Threads

2005-12-16 Thread Steve Holden
Donn Cave wrote: > In article <[EMAIL PROTECTED]>, > Steve Holden <[EMAIL PROTECTED]> wrote: > ... > >>I don't see why you should get problems on SMP hardware, since the >>threads are all part of the same process and should therefore (I'd have >>thought) be tagged with the same processor affini

Re: SMP, GIL and Threads

2005-12-16 Thread catsup
Yes. The test for Empty was edited out. There is a great deal going on in this application, most not germane to the problem. I should perhaps let all of you be the judge of that. Hopefully, this will be enough to help generate ideas. Thanks, Randy -- http://mail.python.org/mailman/listinfo/p

Re: SMP, GIL and Threads

2005-12-16 Thread Peter Hansen
catsup wrote: > The accessing thread takes command requests off a queue, every > half-second, placed there by an altogether different thread, and does a > lookup on this same dictionary before performing this command: > >def run_thread(self): > while( not self.terminate ): > cm

Re: SMP, GIL and Threads

2005-12-16 Thread catsup
Yes. Iterating over a list that you concurrently update will definately cause problems. That is not the type of "read" I am doing in the application. My read is one key/value translation. Below is an example of the operations I am performing to help clarify. The update thread, running once eve

Re: SMP, GIL and Threads

2005-12-16 Thread Greg Copeland
In situations like this, you need to guard the resource with a mutex. In Python, things like insertions are atomic but iterations are not. Thusly, if you wrap it with a mutex, things can be made safe. I saw, "can be", because you then have to ensure you always use the mutex to satify your concurre

Re: SMP, GIL and Threads

2005-12-16 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: ... > I don't see why you should get problems on SMP hardware, since the > threads are all part of the same process and should therefore (I'd have > thought) be tagged with the same processor affinity. Hence the GIL > shoul

Re: SMP, GIL and Threads

2005-12-16 Thread Thomas Heller
Steve Holden <[EMAIL PROTECTED]> writes: > catsup wrote: >> Hi, >> I have an app written under version Python 2.3.5. The problem I'm >> having is that it hangs on one of its threads. The thread that hangs >> does updates to a standard dictionary shared with another thread that >> only reads this

Re: SMP, GIL and Threads

2005-12-16 Thread Steve Holden
catsup wrote: > Hi, > > I have an app written under version Python 2.3.5. The problem I'm > having is that it hangs on one of its threads. The thread that hangs > does updates to a standard dictionary shared with another thread that > only reads this dictionary. This app works beautifully on a

SMP, GIL and Threads

2005-12-16 Thread catsup
Hi, I have an app written under version Python 2.3.5. The problem I'm having is that it hangs on one of its threads. The thread that hangs does updates to a standard dictionary shared with another thread that only reads this dictionary. This app works beautifully on a single processor boxes in