Hi Jon,

Thanks for the reply. From what I read about the GIL, I thought it was 
something inherent in Python and not controllable. Are you sure that releasing 
the GIL during the Mapnik render is not just declaring to the Python runtime 
that a switch of thread execution can take place here? i.e. a thread safe area.

Here's a Wiki entry on GIL:
http://en.wikipedia.org/wiki/Global_Interpreter_Lock

The bit I noted was " Applications written in languages with a GIL have to use 
separate processes (i.e. interpreters) to achieve full concurrency, as each 
interpreter has its own GIL.". Doesn't this suggest that to use multiple 
cores/processors for tiling, separate processes are the way to go rather than 
multiple threads? Threading looks pretty simple in Python so I'll look at doing 
some performance tests myself.

Regards,
Warren

-----Original Message-----
From: Jon Burgess [mailto:[email protected]] 
Sent: 06 September 2009 10:46
To: Warren Vick
Cc: [email protected]
Subject: Re: [Mapnik-users] Multi Threading

On Sun, 2009-09-06 at 09:28 +0100, Warren Vick wrote:
> I've just discovered that Python is a language which does not let
> multiple threads execute at the same time, because the run parallel
> runtime support is based on a central lock (the "Global Interpreter
> Lock"). So, I guess the only way to utilise multiple processors/cores
> is to run separate processes? Or, do all Python programs running on a
> system share the same runtime?

Mapnik can render lots of tiles in parallel via the python bindings. The
GIL is released during the main rendering call so that multiple threads
can run in parallel. I use the feature in the python mod_tile
renderd.py.

The generate_tiles.py has not been updated because it was originally
intended as a simple example program, not a serious tool for rendering
millions of tiles. I'll take a look at adding in some multithreading
into generate_tiles.py.

        Jon


_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to