Doubt on creating threads

Simon Forman sajmikins at
Sat Jan 3 19:56:17 CET 2009

On Jan 3, 8:39 am, koranth... at wrote:
> I was going through Python posts and this post caught my attention
> <quote>
>  You have missed an important point. A well designed application does
>  neither create so many threads nor processes. The creation of a
> thread
>  or forking of a process is an expensive operation. You should use a
> pool
>  of threads or processes.
> </unquote>
> I am creating an application and it creates ~1-2 threads every second
> and kill it within 10 seconds. After reading this I am worried. Is
> creating a thread a very costly operation? I cannot use a pool of
> threads because I am using an external application (twisted) to create
> the threads (deferToThread).

Generally you should only worry about this sort of thing if A) you
actually notice a performance problem and B) testing indicates that
it's thread creation which is causing it.

Otherwise you could spend a lot of time working on something that
doesn't actually affect your app's performance.


More information about the Python-list mailing list