[Baypiggies] multithreading question
aleax at google.com
Thu Sep 18 00:58:53 CEST 2008
On Wed, Sep 17, 2008 at 2:49 PM, Stephen McInerney
<spmcinerney at hotmail.com> wrote:
> I don't think the default assumption "You can safely assume that no module
> is thread-safe unless it claims it is. " is explicitly stated anywhere in
> the Python
> library doc? (http://docs.python.org/lib/*)
> I definitely think that is worth adding?
I guess you could add one more caveat about that to the longish list
at the bottom of http://docs.python.org/lib/module-thread.html .
> Yes, I saw logging has a note saying it is thread-safe, but (for example)
> popen2, Popen3 and Popen4 say nothing, I should assume they're not?
Right -- the file objects returned by popen2 &c aren't thread-safe,
just like those returned by calling the built-in function open aren't
thread-safe, &c, &c.
> [I'm holding the assumption that someday eventually the GIL may go
> away as the typical number of threads increases to the point where it
> becomes commercially important to solve that.]
Python implementations based on virtual machines developed with strong
concern for "commercial importance" (JVM and CLR) are already GIL-free
today; whether it's worth completely re-architecting yet another VM
(CPython's own) towards similar goals is far from obvious to me --
particularly if the goal of such an ambitious effort was meant to be
"commercial importance" rather than developers scratching their own
itch -- what's the commercial value-added to justify the huge
development costs, vs just using another, highly refined and optimized
open source VM such as JVM?
More information about the Baypiggies