Datasheet
“main” (Installation and Administration) — 2004/6/25 — 13:29 — page 534 — #560
i
i
i
i
i
i
i
i
22.5 Threads
A thread is a “lighter” form of a process. The advantage of a thread over
a process is its lower resource consumption. For this reason, the use of
threads instead of processes increases the performance. The disadvantage
is that applications executed in a thread environment must be thread-safe.
This means that:
Functions (or the methods in object-oriented applications) must be
reentrant — a function with the same input always returns the same
result, even if other threads concurrently execute the same function.
Accordingly, functions must be programmed in such a way that they
can be executed simultaneously by severals threads.
The access to resources (usually variables) must be arranged in such a
way that concurrent threads do not conflict.
Apache 2 handles queries as separate processes or in a mixed mode com-
bining processes and threads. The MPM prefork is responsible for the exe-
cution as process. The MPM worker prompts the execution as thread. Select
the MPM to use during the installation (see Section 22.6). The third mode
— perchild — is not yet fully mature and is therefore not available for instal-
lation in SUSE LINUX.
22.6 Installation
22.6.1 Package Selection in YaST
For a basic installation, it is sufficient to select the Apache package
apache2. Additionally, you may install one of the MPM (multiprocess-
ing module) packages, such as apache2-prefork or apache2-worker.
When choosing an MPM, remember that the thread-based worker MPM
cannot be used with mod_php4, as some of the libraries of mod_php4 are
not yet thread-safe.
22.6.2 Activating Apache
After installation, Apache is not started automatically. To start Apache,
activate it in the runlevel editor. To start it permanently when the
534 22.5. Threads










