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

 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
 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 Master WD (user code) to run on Master Thread
 Force the creation of as many threads as available CPUs at initialization time, then block them immediately if needed. 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. 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. 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.