libjmmcg
build_2783
A C++ library containing an eclectic mix of useful, advanced components.
|
#include <thread_pool_aspects.hpp>
Public Types | |
using | queue_model = pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue |
using | exit_requested_type = typename lock::new_event_signal< EvSts, EvSts::unsignalled, EvSts::exit_requested, CST > |
To be used by the thread_pool to signal that it requires the pool_threads it manages should exit, or have closure_base-derived closure to process. More... | |
using | lock_all_type = typename lock::any_order::all< exit_requested_type::lock_traits::api_type, typename exit_requested_type::lock_traits::model_type, typename exit_requested_type::locker_type, typename exit_requested_type::locker_type > |
using | element_type = typename Cont::value_type |
using | value_ret_type = std::array< element_type, GSSk > |
using | container_type = back_batch< queue< Cont, typename exit_requested_type::locker_type, typename exit_requested_type::locker_type::write_lock_type, signalling< exit_requested_type >, value_ret_type, lock_all_type >, GSSk > |
The signalled_work_queue_type is an adapted list to add some thread-safety, because we need to perform multiple operations on it, atomically. More... | |
using | statistics_type = Stats< typename container_type::size_type > |
using | have_work_type = typename container_type::have_work_type |
Public Member Functions | |
thread_pool_queue_details_back_batch_queue () FORCE_INLINE | |
Public Attributes | |
exit_requested_type | exit_requested_ |
This is one exit event for all of the threads in the pool: so that they can exit in parallel. More... | |
container_type | signalled_work_queue |
Static Public Attributes | |
static constexpr generic_traits::memory_access_modes | memory_access_mode =container_type::memory_access_mode |
Definition at line 182 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_back_batch_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, CST, Stats, Cont, GSSk >::container_type = back_batch< queue< Cont, typename exit_requested_type::locker_type, typename exit_requested_type::locker_type::write_lock_type, signalling<exit_requested_type>, value_ret_type, lock_all_type >, GSSk > |
The signalled_work_queue_type is an adapted list to add some thread-safety, because we need to perform multiple operations on it, atomically.
Basically this has been defined as a FIFO or LIFO queue that has locking semantics defined by the specific collection used, and implements a simple list-based scheduling algorithm that assumes that each work-item is the same work-load.
The algorithmic complexity of the operations on this container is based upon the complexity of the operations on the underlying container, in this case an instrusive::slist. This specifically implies that adding and removing an item takes constant time.
This queue would simply implement a bakers' scheduling algorithm: i.e. the active pool_thread would remove k items from the front of the queue to be mutated by that thread.
[1] Casanova, H., Legrand, A., Robert, Y., "Parallel Algorithms", CRC Press, 2008.
Definition at line 237 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_back_batch_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, CST, Stats, Cont, GSSk >::element_type = typename Cont::value_type |
Definition at line 201 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_back_batch_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, CST, Stats, Cont, GSSk >::exit_requested_type = typename lock::new_event_signal< EvSts, EvSts::unsignalled, EvSts::exit_requested, CST > |
To be used by the thread_pool to signal that it requires the pool_threads it manages should exit, or have closure_base-derived closure to process.
This is modelling the functionality of "WaitForMultipleObjects(...)" in the Win32 API.
Definition at line 194 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_back_batch_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, CST, Stats, Cont, GSSk >::have_work_type = typename container_type::have_work_type |
Definition at line 239 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_back_batch_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, CST, Stats, Cont, GSSk >::lock_all_type = typename lock::any_order::all< exit_requested_type::lock_traits::api_type, typename exit_requested_type::lock_traits::model_type, typename exit_requested_type::locker_type, typename exit_requested_type::locker_type > |
Definition at line 200 of file thread_pool_aspects.hpp.
Definition at line 183 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_back_batch_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, CST, Stats, Cont, GSSk >::statistics_type = Stats<typename container_type::size_type> |
Definition at line 238 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_back_batch_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, CST, Stats, Cont, GSSk >::value_ret_type = std::array<element_type, GSSk> |
Return a container of items from the front of the queue to implement the GSS(k) or bakers' scheduling algorithm.
Definition at line 202 of file thread_pool_aspects.hpp.
inline |
Definition at line 253 of file thread_pool_aspects.hpp.
|
mutable |
This is one exit event for all of the threads in the pool: so that they can exit in parallel.
Definition at line 247 of file thread_pool_aspects.hpp.
|
staticconstexpr |
To assist in allowing compile-time computation of the algorithmic order of the threading model.
Definition at line 244 of file thread_pool_aspects.hpp.
container_type jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_back_batch_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, CST, Stats, Cont, GSSk >::signalled_work_queue |
This implies that the thread_pool assumes a flat memory model, shared across all processors. This may not reflect reality well, in the face of caches.
Definition at line 251 of file thread_pool_aspects.hpp.