Originariamente inviata da
oregon
Avete fatto un mischione di processi e thread senza senso.
E che sarebbero i 'server'?
Processi server...mai sentito parlare?
In pratica istanze del "programma". Ho anche riportato l'esempio più conosciuto (più o meno) di programma che lavora con "server", "thread" e "child"...più di così!
codice:
A single control process (the parent) is responsible for launching child processes. Each child process creates a fixed number of server threads as specified in the ThreadsPerChild directive, as well as a listener thread which listens for connections and passes them to a server thread for processing when they arrive.
Apache HTTP Server always tries to maintain a pool of spare or idle server threads, which stand ready to serve incoming requests. In this way, clients do not need to wait for a new threads or processes to be created before their requests can be served. The number of processes that will initially launch is set by the StartServers directive. During operation, the server assesses the total number of idle threads in all processes, and forks or kills processes to keep this number within the boundaries specified by MinSpareThreads and MaxSpareThreads. Since this process is very self-regulating, it is rarely necessary to modify these directives from their default values. The maximum number of clients that may be served simultaneously (i.e., the maximum total number of threads in all processes) is determined by the MaxRequestWorkers directive. The maximum number of active child processes is determined by the MaxRequestWorkers directive divided by the ThreadsPerChild directive.
Il processo principale lancia dei child (tipicamente 4, nel caso di apache) che sono null'altro che "copie" di se stesso. Ogni child lancia dei thread che in totale possono gestire MaxRequestWorkers richieste contemporanee.
Apache usa una terminologia "parent - child - server thread - client" ma il concetto è lo stesso se espresso come "server - thread - child", basta accordarsi sulle convenzioni :-)