4 ms·
Languages have affordances. At the extreme ends are PHP, and Java or Go. PHP runs a separate logical process on every request which can't share resources with a
by pocksuppet 2mo ago
Languages have affordances. At the extreme ends are PHP, and Java or Go. PHP runs a separate logical process on every request which can't share resources with any other request. Almost everyone using Go is writing a long-running server process because that's how the libraries are designed. Almost everyone using Java is writing a long-running process or a module for one, because Java startup times are obscene. Java also has a very convenient synchronization primitive.
- mike_hearn 2mo agoMulti-threaded processes are used because that's the most efficient model, hardware wise. Tasks can maximally share resources. It's not to do with library design or startup time.
- pocksuppet 2mo agoThe hardware doesn't know anything about processes. The most efficient model, hardware-wise, is to disable virtual memory and never do a context switch, but we don't see anyone programming like that, except for the crazy SDN folks who are doing software packet forwarding at hundred-gigabit rates.
- mike_hearn 2mo agoWell, a server running a single process is fairly close to that. Switching to kernel mode doesn't require a full context switch and nor does switching between threads.
- tredre3 2mo ago> PHP runs a separate logical process on every request which can't share resources with any other request. PHP allows persistent connections to postgres that will be reused by subsequent requests. But of course the connection isn't shared by concurrent requests (unless you use Swoole), so it doesn't solve the process-per-connection on postgres' side, it merely saves some overhead.