The canonical implementation of the Python programming language is based on C language. The term “CPython” is used when necessary to distinguish this implementation from others such as Jython or IronPython.
In CPython/Python, there is an important lock named global interpreter lock (GIL), which is the mechanism used by the CPython interpreter to assure that only one thread executes Python bytecode at a time. This simplifies the CPython implementation by making the object model (including critical built-in types such as dict) implicitly safe against concurrent access. Locking the entire interpreter makes it easier for the interpreter to be multi-threaded, at the expense of much of the parallelism afforded by multi-processor machines. Past efforts to create a “free-threaded” interpreter (one which locks shared data at a much finer granularity) have not been successful because performance suffered in the common single-processor case. It is believed that overcoming this performance issue would make the implementation much more complicated and therefore costlier to maintain.
GIL actually prevents threads from running in parallel in Python. The GIL is only a problem when tackling CPU-bounded problems in Python, but it is not a big problem for I/O bounded threads.
Solutions:
(1) Jython is free of GIL;
(2) Cython;
Friday, February 10, 2012
Subscribe to:
Post Comments (Atom)
1 comment:
gogo anime Watch anime online in English. You can watch free series and movies online and English subtitle.
Lottery sambad is the Indian lottery system. The important and main thing which attracts the people to invest in this lottery is the number of prizes and size of the lottery. There are many other lotteries in India but sambad is a very popular lottery among the Indian people.
Post a Comment