Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
An Introduction to Thread Programming in Python (prasannatech.net)
7 points by soundsop on Aug 11, 2008 | hide | past | favorite | 3 comments



Just keep in mind that via the GIL (Global Interpreter Lock) Python limits the system to executing one bytecode instruction at a time - Threads execute in a more serial fashion, switching context every 100 bytecode instructions or so (e.g. let Thread 1 have 100 bytecodes, then switch to Thread 2).

This is a good thing and a bad thing - internally it keeps some non-threadsafe components from asploding but can be confusing and frustrating if you're looking for true multithreading.

There are some implementations of Python that don't use a GIL, such as stackless, if you're looking for true multithreading.


Primitive. Not real threads, more like co-routines. This will be a real limitation for python, especially when multi-core CPUs are the norm.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: