On Fri, Oct 4, 2013 at 2:41 AM, Roy Smith <r...@panix.com> wrote: > The downside to threads is that all of of this sharing makes them much > more complicated to use properly. You have to be aware of how all the > threads are interacting, and mediate access to shared resources. If you > do that wrong, you get memory corruption, deadlocks, and all sorts of > (extremely) difficult to debug problems. A lot of the really hairy > problems (i.e. things like one thread continuing to use memory which > another thread has freed) are solved by using a high-level language like > Python which handles all the memory allocation for you, but you can > still get deadlocks and data corruption.
With CPython, you don't have any headaches like that; you have one very simple protection, a Global Interpreter Lock (GIL), which guarantees that no two threads will execute Python code simultaneously. No corruption, no deadlocks, no hairy problems. ChrisA -- https://mail.python.org/mailman/listinfo/python-list