Problem in threading

Binu K S binux.lists at gmail.com
Wed Dec 29 11:00:19 CET 2004


You haven't split the task between the threads here.
loops should be set to [2500,2500] for a correct comparison.

On a single processor system, a tight loop like the one you are
testing will at best show the same time as the non-threaded case. Most
likely the threaded version will take more time on single processor
systems due to the thread context switching overhead.

On a multi-processor system too, you are likely to see the same
figures since what you are measuring with time.clock is the amount of
CPU time taken. That will be the same in the threaded and non-threaded
case. On the multi-processor system you will see a difference in
actual time taken by both. You could use time.time to measure that.

On Wed, 29 Dec 2004 14:33:12 +0530, Gurpreet Sachdeva
<gurpreet.sachdeva at gmail.com> wrote:
> >    threads[i].join()
> 
> Oh thanks I corrected that but still the time taken after using thread
> is more without using them....
> 
> Please Advice...
> Thanks,
> Gurpreet Singh
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list