### 5.2 PolyORB ORB Tasking policies

PolyORB ORB Tasking policies control the creation of tasks to process all middleware internal jobs, e.g. request processing, I/O monitoring.

Note: there is a dependency between ORB Tasking policies, and the runtime used, as detailed below.

#### 5.2.1 No Tasking

Under the No Tasking ORB policy, no tasks are created within the middleware instance: it uses the environment task to process all jobs. Note that this policy is not thread safe and is compatible with the No tasking runtime only.

#### 5.2.2 Thread Pool

Under the Thread Pool ORB policy, the middleware creates a pool of threads during initialization of PolyORB. This pool processes all jobs. The number of tasks in the thread pool can be configured by three parameters in the `[tasking]` configuration section.

- `min_spare_threads` indicates the number of tasks created at startup.
- `max_spare_threads` is a ceiling. When a remote subprogram call is completed, its anonymous task is deallocated if the number of unused tasks already in the pool is greater than the ceiling. If not, then the task is queued in the pool.
- `max_threads` indicates the maximum number of tasks in the pool.

See PolyORB Tasking configuration, for more information on how to configure the number of tasks in the thread pool.

#### 5.2.3 Thread Per Session

Under the Thread Per Session ORB policy, the middleware creates one task when a new session (one active connection) is opened. The task terminates when the session is closed.

#### 5.2.4 Thread Per Request

Under the Thread Per Request ORB policy, the middleware creates one task per incoming request. The task terminates when the request is completed.