Hi,
I had a look at the sources of FastCGI (fcgi-2.4.0) and actually there's no sign of fork. If I'm correct the web server spwans a process for FastCGI module (compiled in it or loaded as a SO/DLL) and handles control of the main socket (the port TCP:80 usually) over to it.
On *nix the FastCGI module "locks" that socket using a file write lock (libfcgi/os_unix.c:989) on the whole file descriptor (the listen socket indeed); this way when new connections income only the FastCGI module is able to process these. The incoming socket lock is released just before handing over to the HTTP req processing.
As seen as FastCGI module is not multi process/thread (no internal usage of fork/pthread_create) I assume the concurrent handling of multiple simultaneous connections is obtained through spwaning from the web server (through OS_SpawnChild) of n FastCGI module processes. If we spawn, as example, 3 FastCGI processes (Apache calls 3 x OS_SpawnChild), does that mean that we could only have max 3 requests served concurrently?
A) Is my vision of FastCGI way of working correct?
B) If the cost for the OS to spawn a new process/create a connection to local DB could be considered negligible, what are the advantages of FastCGI against an old fashioned executable approach?
Thanks, Ema! :-)