Python, COM Servers, and Multi-Threading

Carl Waldbieser waldbie at yahoo.com
Mon Oct 10 19:46:15 EDT 2005


I have been considering using Python and the Reportlab library for
generating PDF reports for the back-end of a web based application.  The
application runs most of its background tasks on a dedicated server that is
Windows based (Win2K or Win2k3).  The program that launches the tasks
requires a COM-based interface, so I wrote a Python COM server using Mark
Hammond's PythonCom libraries and import and run the reporlab modules from
there.

I had been reading up on Python and it's handling of the multiple threads,
specifically the Global Interpreter Lock (GIL).  I got to wondering if a
multi-processor machine machine would be able to take advantage of its
extra processing power using this setup.  I am guessing that the GIL is
global with respect to each instance of a running Python interpreter, so if
say 4 interpreters were running, a 4 processor machine would be able to
take advantage of this.  However, I am not quite sure how launching my
reports via COM behaves-- if I launched 4 reports this way, would that be
like launching 4 seperate instances of the Python interpreter, or would it
be just a single instance, and therefore run into the limitations of the
GIL?  If so, can anybody offer suggestions as to a design that would be
better able to take advantage of a multi-processor machine?

Thanks,
Carl Waldbieser




More information about the Python-list mailing list