Re: php and multithreading (additional arguments)
| From: | Stanislav Malyshev | Date: | Thu, 01 Apr 2010 21:33:59 +0000 |
| Subject: | Re: php and multithreading (additional arguments) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47724@lists.php.net to get a copy of this message | ||
Hi!
Eve Online in Stackless Python fmspy.org <http://fmspy.org> with stackless python etc.I don't know how python does it but PHP has a lot of global context, and sharing this global context between threads, whatever they are (OS threads, user-space threads, etc.) would be massively complex thing tp manage either for the engine or for the user.
GIL would mean dreams about multicore stuff are just dreams, but beyond that even with GIL, what do you do if you checked for class_exists and it didn't exist, and you're about to load it when other thread loads it before? Etc., etc. You'd have to spend a lot of time thinking about stuff like that in your code. The fact that GIL protects you from C-level context changes doesn't mean it'd protect you from PHP-level context changes, like some code using some data structure and other code changing it (on C level it'd be ok - no memory corruption, etc. - but on PHP level it might totally break your code). It's not to say it can't be done, but I didn't see yet coherent proposal for any threads implementation that had also good use cases.And something like GIL feels like a reasonable compromise to me.
I think PHP is the last from the major scripting languages on the market without some kind of thread support. (Cannot find a good comparsion, but Ruby, Python, Perl does some)And "keeping up with Joneses" is not a good use case. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com