[nycphp-talk] thread-safety analysis...

Vugranam Sreedhar vugranam at
Sun Oct 22 07:35:11 EDT 2006

Thanks for the nice explanation... Would PHP ever become multithreaded...
Since Apache 2+ will continue to course of multithreading I am
sure PHP will eventually have to catch up the multithreading direction...

With regards,



Research Staff Member
TJ Watson Research Center
T/L 863-7325
Ext: 914-784-7325

             Paul Houle                                                    
             <paul at devonianfar                                             
   >                                                     To 
             Sent by:                  NYPHP Talk <talk at>   
             talk-bounces at list                                          cc 
                                       Re: [nycphp-talk] thread-safety      
             10/21/2006 10:29          analysis...                         
             Please respond to                                             
                NYPHP Talk                                                 
             <talk at lists.nyphp                                             

Hans Zaunere wrote:
> The problem really is not thread safe code written in the PHP language,
> rather the environment in which PHP runs in.  Now PHP can be compiled for
> thread safety (TSRM, for instance  However,
> because PHP is often linked against so many external libraries
> (gd/jpeg/xml/etc) it cannot be considered safe to execute in a threaded
> environment.  This is the real problem and one of PHP's greatest
> and unfortunate faults.
    This is also a problem for Perl,  Python and many other languages
which are advertised as thread-safe.  Java runtimes are threadsafe
because of a general xenophobia:  the Java runtimes link in a limited
number of C libraries,  and Java programmers don't really believe in
linking in C libraries...  Though I have to admit that I've had good
luck linking Java to Fortran.

    Lacking threads,  the big disadvantage of PHP is that it consumes
more memory.  Data structures need to be replicated for each copy of
PHP.  That said,  RAM is getting cheaper,  and PHP is parsimonious in
it's memory use,  so most of us do just fine running PHP in processes
instead of threads.
New York PHP Community Talk Mailing List

NYPHPCon 2006 Presentations Online

Show Your Participation in New York PHP

More information about the talk mailing list