2.3.3.6. Thread Manager

The Thread Manager module controls the amount of working threads needed for a specific amount of workload. It could be useful to block idle threads when they are not needed or even to create auxiliary threads in a heavy work load scenario if we have resources to spare.

Thread Manager options

--thread-manager=<none,nanos,dlb>
 Select which Thread Manager will be used
--enable-dlb Enable inter-process management with Dynamic Load Balancing (DLB) library
--enable-block Enable thread blocking on idle loop
--enable-sleep Enable thread sleeping on idle loop
--sleep-time=<n>
 Set the amount of time (in nsec) in each sleeping phase
--enable-yield Enable thread yielding on idle loop
--yields=<n> Set number of yields before blocking
--force-tie-master
 Force Master WD (user code) to run on Master Thread
--warmup-threads
 Force the creation of as many threads as available CPUs at initialization time, then block them immediately if needed.

2.3.3.6.1. List of thread managers

Nanos++ provides the selection of the thread manager to use through the option --thread-manager. The default value is none, unless one or more of the options --enable-dlb, --enable-yield, --enable-block or --enable-sleep are selected, which in this case the default value is nanos.

2.3.3.6.1.1. Thread Manager: Nanos

If --enable-block is used, Nanos++ will temporarily block those threads that are not considered useful. As soon as Nanos++ detects an increase in the workload, the threads will be activated again.

Alternatively, if --enable-sleep is used, Nanos++ will temporarily sleep for a fixed amount of time those threads that are not considered useful. After that, the threads are activated again.

2.3.3.6.1.2. Thread Manager: DLB

Thread manager DLB (do not confuse with --enable-dlb, which only enables some DLB features), yields the complete thread control to the DLB library. Each thread can be individually blocked as in the Nanos Thread Manager but DLB can give the resources associated to this thread to another process.