Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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.



>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

To date, nobody has taken something like that and done the work to connect it to a front end handler.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: