Thread killing - I know I know!

sjdevnull at yahoo.com sjdevnull at yahoo.com
Fri May 16 13:46:58 EDT 2008


On May 16, 11:40 am, Roger Heathcote <use... at technicalbloke.com>
wrote:
> Hello everyone, this is my first post so hello & please be gentle!
>
> Despite many peoples insistence that allowing for the arbitrary killing
> of threads is a cardinal sin and although I have no particular threading
> problem to crack right now I remain interest in the taboo that is thread
> killing. The real world and it's data are messy and imperfect and I can
> think of several scenarios where it could be useful to be able to bump
> off a naughty thread, especially when using/testing unstable 3rd party
> modules and other code that is an unknown quantity.

When possible, use another process _especially_ for things like this.
That way you have more isolation between yourself and the unknown/
unstable code, and killing processes is well-understand and considered
less harmful (precisely because of the greater isolation).

In general, use processes when you can and threads only when you
must.  OS designers spent a lot of energy implementing protected
memory, no sense throwing out a fair chunk of that hard work unless
you actually need to.



More information about the Python-list mailing list