Sturla Molden wrote:
On 10.02.2012 19:36, M.-A. Lemburg wrote:
In cases where the GIL does cause problems, it's usually better to consider changing the application design and use asynchronous processing with a single threaded design or a multi-process design where each of the processes only uses a low number of threads (20-50 per process).
The "GIL problem" is much easier to analyze than most Python developers using Linux might think:
- Windows has no fork system call. SunOS used to have a very slow fork system call. The majority of Java developers worked with Windows or Sun, and learned to work with threads.
For which the current summary is:
- The GIL sucks because Windows has no fork.
Which some might say is the equivalent of:
- Windows sucks.
I'm not sure why you think you need os.fork() in order to work with multiple processes. Spawning processes works just as well and, often enough, is all you really need to get the second variant working. The first variant doesn't need threads at all, but can not always be used since it requires all application components to play along nicely with the async approach. I forgot to mention a third variant: use a multi-process design with single threaded asynchronous processing in each process. This third variant is becoming increasingly popular, esp. if you have to handle lots and lots of individual requests with relatively low need for data sharing between the requests. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 10 2012)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/