CPython GIL threading problem.
We work on a linux server. When I type python, the information is as follow:
Code:
Python 2.6.6 (r266:84292, May 1 2012, 13:52:42) When I write a threading program, I found some threads would starve. After some google, I realize there is a thing called GIL(Global Interpreter Lock) in CPython. If I want to use multithreading in python, What would you suggest? Thanks in advance! example code that create a thread, and one of the thread would starve in my linux. Code:
import time |
Your example code seems to work fine for me, except it doesn't handle keyboard interrupts well at all. You should avoid threading if possible, or if you're serious about it, maybe another language is more appropriate. For example Go uses a lot of concurrency and threading and stuff. But it's very, very different from Python.
|
All times are GMT -5. The time now is 09:02 PM. |