3 ms·
> Not any more than this is the case with Python, PHP, Rails, etc -- which also don't do multi-threaded Why isn't PHP etc called single-threaded then? I though
by Kiro 9y ago
> Not any more than this is the case with Python, PHP, Rails, etc -- which also don't do multi-threaded
Why isn't PHP etc called single-threaded then? I thought the difference was in fact that PHP fires up new threads for each connection.
- tyingq 9y ago>I thought the difference was in fact that PHP fires up new threads for each connection. PHP doesn't get to decide what happens for each new connection. That's determined upstream, and there's a lot of different pieces of software people choose to do that. Could be directly a webserver like apache's mod_php, or something like fastcgi, php-fpm, etc. All of those front-ends chose to implement a model of a php process pool. Multiple processes, each with a single php interpreter running. Incoming connections are sent to a process in the pool. So, if the pool is 5 processes, and you get a 6th concurrent connection, that one waits. However, you can write a C program with a single process and distinct php interpreter per thread. One example: https://github.com/basvanbeek/embed2-sapi https://github.com/basvanbeek/embed2-sapi To date, nobody has taken something like that and done the work to connect it to a front end handler.