3 ms·
The main benefit of the threadsafe builds was reentrancy support for multithreaded web servers (e.g. IIS / some apache MPMs). They were only slightly slower for
by mappu 3y ago
The main benefit of the threadsafe builds was reentrancy support for multithreaded web servers (e.g. IIS / some apache MPMs). They were only slightly slower for single-threaded code.
The new PHP 8 fibers are only coroutines on a single thread, but PHP has had fork/join since 2001 (!), which works pretty well with Linux CoW.
There has been a pthreads extension since about 2012. However keeping a 1:1 pthreads API prevents some optimization possibilities [1], so the new hotness is php-parallel [2], which will transparently copy closed-over variables to a subinterpreter.
1. https://github.com/krakjoe/pthreads/issues/929#issue-410636734 https://github.com/krakjoe/pthreads/issues/929#issue-4106367...
2. https://www.php.net/manual/en/philosophy.parallel.php https://www.php.net/manual/en/philosophy.parallel.php