Module Thread_pool.Work_group

module Work_group: sig .. end

type t 
Each piece of work in the thread pool is associated with a "work group", which is used to control the number of threads used for work in the group. When a thread is performing work for a work group, it is said to be "assigned" to that work group. Each work group has two optional limits: min_assignable_threads and max_assigned_threads.

The thread pool guarantees that requests to have threads assigned to this work group will be met by at least min_assignable_threads threads. The thread pool will never assign more than max_assigned_threads to the work group. The thread pool does not actually reserve specific threads for the work group. It uses the same set of threads for all work groups. Over time, a single thread may do work for different groups. Work groups are just an accounting mechanism to make sure the number of threads from the global pool that are being used for each work group meet the requirements of that group.

Each work group has its own dedicated work queue. If a client requests to do some work in a group, and that group already has min_assignable_threads threads assigned to it, and there are no other available threads or the group already has max_assigned_threads assigned to it, then the work will be placed on the work group's queue, and will be handled in the future when threads become available to the group.

If multiple work groups have work waiting to be done, the thread pool will round-robin among them as threads become available.

val sexp_of_t : t -> Sexplib.Sexp.t