Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
arena.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2005-2019 Intel Corporation
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 #ifndef _TBB_arena_H
18 #define _TBB_arena_H
19 
20 #include "tbb/tbb_stddef.h"
21 #include "tbb/atomic.h"
22 
23 #include "tbb/tbb_machine.h"
24 
25 #include "scheduler_common.h"
26 #include "intrusive_list.h"
27 #if __TBB_PREVIEW_CRITICAL_TASKS && __TBB_CPF_BUILD
28 #include "task_stream_extended.h"
29 #else
30 #include "task_stream.h"
31 #endif
32 #include "../rml/include/rml_tbb.h"
33 #include "mailbox.h"
34 #include "observer_proxy.h"
35 #include "market.h"
36 #include "governor.h"
37 #include "concurrent_monitor.h"
38 
39 #if __TBB_PREVIEW_RESUMABLE_TASKS
40 #include "tbb/spin_mutex.h"
41 #endif
42 
43 namespace tbb {
44 
45 class task_group_context;
46 class allocate_root_with_context_proxy;
47 
48 namespace internal {
49 
50 #if __TBB_PREVIEW_RESUMABLE_TASKS
51 class arena_co_cache {
54  generic_scheduler** my_co_scheduler_cache;
56  unsigned my_head;
58  unsigned my_max_index;
60  tbb::spin_mutex my_co_cache_mutex;
61 
62  unsigned next_index() {
63  return ( my_head == my_max_index ) ? 0 : my_head + 1;
64  }
65 
66  unsigned prev_index() {
67  return ( my_head == 0 ) ? my_max_index : my_head - 1;
68  }
69 
70  bool internal_empty() {
71  return my_co_scheduler_cache[prev_index()] == NULL;
72  }
73 
74  void internal_scheduler_cleanup(generic_scheduler* to_cleanup) {
75  to_cleanup->my_arena_slot = NULL;
76  // Needed by cleanup_worker function, as well as arena slot clearing
77  governor::assume_scheduler(to_cleanup);
78  generic_scheduler::cleanup_worker(to_cleanup, true);
79  }
80 
81 public:
82  void init(unsigned cache_capacity) {
83  size_t alloc_size = cache_capacity * sizeof(generic_scheduler*);
84  my_co_scheduler_cache = (generic_scheduler**)NFS_Allocate(1, alloc_size, NULL);
85  memset( my_co_scheduler_cache, 0, alloc_size );
86  my_head = 0;
87  my_max_index = cache_capacity - 1;
88  }
89 
90  void cleanup() {
91  generic_scheduler* current = governor::local_scheduler_if_initialized();
92  while (generic_scheduler* to_cleanup = pop()) {
93  internal_scheduler_cleanup(to_cleanup);
94  }
96  NFS_Free(my_co_scheduler_cache);
97  }
98 
101  void push(generic_scheduler* s) {
102  generic_scheduler* to_cleanup = NULL;
103  {
104  tbb::spin_mutex::scoped_lock lock(my_co_cache_mutex);
105  // Check if we are replacing some existing buffer entrance
106  if (my_co_scheduler_cache[my_head] != NULL) {
107  to_cleanup = my_co_scheduler_cache[my_head];
108  }
109  // Store the cached value
110  my_co_scheduler_cache[my_head] = s;
111  // Move head index to the next slot
112  my_head = next_index();
113  }
114  // Cleanup replaced buffer if any
115  if (to_cleanup) {
116  generic_scheduler* current = governor::local_scheduler_if_initialized();
117  internal_scheduler_cleanup(to_cleanup);
119  }
120  }
121 
123  generic_scheduler* pop() {
124  tbb::spin_mutex::scoped_lock lock(my_co_cache_mutex);
125  // No cached coroutine
126  if (internal_empty()) return NULL;
127  // Move head index to the currently available value
128  my_head = prev_index();
129  // Retrieve the value from the buffer
130  generic_scheduler* to_return = my_co_scheduler_cache[my_head];
131  // Clear the previous entrance value
132  my_co_scheduler_cache[my_head] = NULL;
133  return to_return;
134  }
135 };
136 #endif // __TBB_PREVIEW_RESUMABLE_TASKS
137 
139 
141 struct arena_base : padded<intrusive_list_node> {
143  unsigned my_num_workers_allotted; // heavy use in stealing loop
144 
146 
149  atomic<unsigned> my_references; // heavy use in stealing loop
150 
151 #if __TBB_TASK_PRIORITY
152  volatile intptr_t my_top_priority; // heavy use in stealing loop
154 #endif /* !__TBB_TASK_PRIORITY */
155 
157  atomic<unsigned> my_limit; // heavy use in stealing loop
158 
160 
165 #if __TBB_PREVIEW_CRITICAL_TASKS && __TBB_CPF_BUILD
166  task_stream<num_priority_levels, front_accessor> my_task_stream; // heavy use in stealing loop
167 #else
168  task_stream<num_priority_levels> my_task_stream; // heavy use in stealing loop
169 #endif
170 
171 #if __TBB_PREVIEW_CRITICAL_TASKS
172 
176  // used on the hot path of the task dispatch loop
177  task_stream<1, back_nonnull_accessor> my_critical_task_stream;
178 #endif
179 
182 
185 
187 
191  tbb::atomic<uintptr_t> my_pool_state;
192 
193 #if __TBB_ARENA_OBSERVER
194  observer_list my_observers;
196 #endif
197 
198 #if __TBB_TASK_PRIORITY
199  intptr_t my_bottom_priority;
201 
203 
205  uintptr_t my_reload_epoch;
206 
208  task* my_orphaned_tasks;
209 
211  tbb::atomic<uintptr_t> my_abandonment_epoch;
212 
214 
217  tbb::atomic<intptr_t> my_skipped_fifo_priority;
218 #endif /* !__TBB_TASK_PRIORITY */
219 
220  // Below are rarely modified members
221 
224 
226  uintptr_t my_aba_epoch;
227 
228 #if !__TBB_FP_CONTEXT
229  cpu_ctl_env my_cpu_ctl_env;
231 #endif
232 
233 #if __TBB_TASK_GROUP_CONTEXT
234 
237  task_group_context* my_default_ctx;
238 #endif /* __TBB_TASK_GROUP_CONTEXT */
239 
241  unsigned my_num_slots;
242 
245 
246 #if __TBB_ENQUEUE_ENFORCED_CONCURRENCY
247  // arena needs an extra worker despite the arena limit
248  bool my_local_concurrency_mode;
249  // arena needs an extra worker despite a global limit
250  bool my_global_concurrency_mode;
251 #endif /* __TBB_ENQUEUE_ENFORCED_CONCURRENCY */
252 
255 
256 #if __TBB_PREVIEW_RESUMABLE_TASKS
257  arena_co_cache my_co_cache;
259 #endif
260 
261 #if TBB_USE_ASSERT
262  uintptr_t my_guard;
264 #endif /* TBB_USE_ASSERT */
265 }; // struct arena_base
266 
267 class arena: public padded<arena_base>
268 {
270  void restore_priority_if_need();
271 public:
273 
278  work_enqueued
279  };
280 
282  arena ( market&, unsigned max_num_workers, unsigned num_reserved_slots );
283 
285  static arena& allocate_arena( market&, unsigned num_slots, unsigned num_reserved_slots );
286 
287  static int unsigned num_arena_slots ( unsigned num_slots ) {
288  return max(2u, num_slots);
289  }
290 
291  static int allocation_size ( unsigned num_slots ) {
292  return sizeof(base_type) + num_slots * (sizeof(mail_outbox) + sizeof(arena_slot));
293  }
294 
297  __TBB_ASSERT( 0<id, "affinity id must be positive integer" );
298  __TBB_ASSERT( id <= my_num_slots, "affinity id out of bounds" );
299 
300  return ((mail_outbox*)this)[-(int)id];
301  }
302 
304  void free_arena ();
305 
306  typedef uintptr_t pool_state_t;
307 
309  static const pool_state_t SNAPSHOT_EMPTY = 0;
310 
312  static const pool_state_t SNAPSHOT_FULL = pool_state_t(-1);
313 
315  static const unsigned ref_external_bits = 12; // up to 4095 external and 1M workers
316 
318  static const unsigned ref_external = 1;
319  static const unsigned ref_worker = 1<<ref_external_bits;
320 
322  static bool is_busy_or_empty( pool_state_t s ) { return s < SNAPSHOT_FULL; }
323 
325  unsigned num_workers_active() const {
326  return my_references >> ref_external_bits;
327  }
328 
330  bool is_recall_requested() const {
331  return num_workers_active() > my_num_workers_allotted;
332  }
333 
335  template<arena::new_work_type work_type> void advertise_new_work();
336 
338 
339  bool is_out_of_work();
340 
342  void enqueue_task( task&, intptr_t, FastRandom & );
343 
345  void process( generic_scheduler& );
346 
348  template<unsigned ref_param>
349  inline void on_thread_leaving ( );
350 
351 #if __TBB_STATISTICS
352  void dump_arena_statistics ();
354 #endif /* __TBB_STATISTICS */
355 
356 #if __TBB_TASK_PRIORITY
357 
359  inline bool may_have_tasks ( generic_scheduler*, bool& tasks_present, bool& dequeuing_possible );
360 
362  void orphan_offloaded_tasks ( generic_scheduler& s );
363 #endif /* __TBB_TASK_PRIORITY */
364 
365 #if __TBB_COUNT_TASK_NODES
366  intptr_t workers_task_node_count();
368 #endif
369 
371  bool has_enqueued_tasks();
372 
373  static const size_t out_of_arena = ~size_t(0);
375  template <bool as_worker>
376  size_t occupy_free_slot( generic_scheduler& s );
378  size_t occupy_free_slot_in_range( generic_scheduler& s, size_t lower, size_t upper );
379 
381  arena_slot my_slots[1];
382 }; // class arena
383 
384 template<unsigned ref_param>
385 inline void arena::on_thread_leaving ( ) {
386  //
387  // Implementation of arena destruction synchronization logic contained various
388  // bugs/flaws at the different stages of its evolution, so below is a detailed
389  // description of the issues taken into consideration in the framework of the
390  // current design.
391  //
392  // In case of using fire-and-forget tasks (scheduled via task::enqueue())
393  // master thread is allowed to leave its arena before all its work is executed,
394  // and market may temporarily revoke all workers from this arena. Since revoked
395  // workers never attempt to reset arena state to EMPTY and cancel its request
396  // to RML for threads, the arena object is destroyed only when both the last
397  // thread is leaving it and arena's state is EMPTY (that is its master thread
398  // left and it does not contain any work).
399  // Thus resetting arena to EMPTY state (as earlier TBB versions did) should not
400  // be done here (or anywhere else in the master thread to that matter); doing so
401  // can result either in arena's premature destruction (at least without
402  // additional costly checks in workers) or in unnecessary arena state changes
403  // (and ensuing workers migration).
404  //
405  // A worker that checks for work presence and transitions arena to the EMPTY
406  // state (in snapshot taking procedure arena::is_out_of_work()) updates
407  // arena::my_pool_state first and only then arena::my_num_workers_requested.
408  // So the check for work absence must be done against the latter field.
409  //
410  // In a time window between decrementing the active threads count and checking
411  // if there is an outstanding request for workers. New worker thread may arrive,
412  // finish remaining work, set arena state to empty, and leave decrementing its
413  // refcount and destroying. Then the current thread will destroy the arena
414  // the second time. To preclude it a local copy of the outstanding request
415  // value can be stored before decrementing active threads count.
416  //
417  // But this technique may cause two other problem. When the stored request is
418  // zero, it is possible that arena still has threads and they can generate new
419  // tasks and thus re-establish non-zero requests. Then all the threads can be
420  // revoked (as described above) leaving this thread the last one, and causing
421  // it to destroy non-empty arena.
422  //
423  // The other problem takes place when the stored request is non-zero. Another
424  // thread may complete the work, set arena state to empty, and leave without
425  // arena destruction before this thread decrements the refcount. This thread
426  // cannot destroy the arena either. Thus the arena may be "orphaned".
427  //
428  // In both cases we cannot dereference arena pointer after the refcount is
429  // decremented, as our arena may already be destroyed.
430  //
431  // If this is the master thread, the market is protected by refcount to it.
432  // In case of workers market's liveness is ensured by the RML connection
433  // rundown protocol, according to which the client (i.e. the market) lives
434  // until RML server notifies it about connection termination, and this
435  // notification is fired only after all workers return into RML.
436  //
437  // Thus if we decremented refcount to zero we ask the market to check arena
438  // state (including the fact if it is alive) under the lock.
439  //
440  uintptr_t aba_epoch = my_aba_epoch;
441  market* m = my_market;
442  __TBB_ASSERT(my_references >= ref_param, "broken arena reference counter");
443 #if __TBB_STATISTICS_EARLY_DUMP
444  // While still holding a reference to the arena, compute how many external references are left.
445  // If just one, dump statistics.
446  if ( modulo_power_of_two(my_references,ref_worker)==ref_param ) // may only be true with ref_external
447  GATHER_STATISTIC( dump_arena_statistics() );
448 #endif
449 #if __TBB_ENQUEUE_ENFORCED_CONCURRENCY
450  // When there is no workers someone must free arena, as
451  // without workers, no one calls is_out_of_work().
452  // Skip workerless arenas because they have no demand for workers.
453  // TODO: consider more strict conditions for the cleanup,
454  // because it can create the demand of workers,
455  // but the arena can be already empty (and so ready for destroying)
456  // TODO: Fix the race: while we check soft limit and it might be changed.
457  if( ref_param==ref_external && my_num_slots != my_num_reserved_slots
458  && 0 == m->my_num_workers_soft_limit && !my_global_concurrency_mode ) {
459  bool is_out = false;
460  for (int i=0; i<num_priority_levels; i++) {
461  is_out = is_out_of_work();
462  if (is_out)
463  break;
464  }
465  // We expect, that in worst case it's enough to have num_priority_levels-1
466  // calls to restore priorities and yet another is_out_of_work() to conform
467  // that no work was found. But as market::set_active_num_workers() can be called
468  // concurrently, can't guarantee last is_out_of_work() return true.
469  }
470 #endif
471  if ( (my_references -= ref_param ) == 0 )
472  m->try_destroy_arena( this, aba_epoch );
473 }
474 
475 template<arena::new_work_type work_type> void arena::advertise_new_work() {
476  if( work_type == work_enqueued ) {
477 #if __TBB_ENQUEUE_ENFORCED_CONCURRENCY
478  if ( as_atomic(my_market->my_num_workers_soft_limit) == 0 && as_atomic(my_global_concurrency_mode) == false )
479  my_market->enable_mandatory_concurrency(this);
480 
481  if ( my_max_num_workers == 0 && my_num_reserved_slots == 1 ) {
482  __TBB_ASSERT(!my_local_concurrency_mode, NULL);
483  my_local_concurrency_mode = true;
484  my_pool_state = SNAPSHOT_FULL;
485  my_max_num_workers = 1;
486  my_market->adjust_demand(*this, my_max_num_workers);
487  return;
488  }
489 #endif /* __TBB_ENQUEUE_ENFORCED_CONCURRENCY */
490  // Local memory fence here and below is required to avoid missed wakeups; see the comment below.
491  // Starvation resistant tasks require concurrency, so missed wakeups are unacceptable.
492  atomic_fence();
493  }
494  else if( work_type == wakeup ) {
495  __TBB_ASSERT(my_max_num_workers!=0, "Unexpected worker wakeup request");
496  atomic_fence();
497  }
498  // Double-check idiom that, in case of spawning, is deliberately sloppy about memory fences.
499  // Technically, to avoid missed wakeups, there should be a full memory fence between the point we
500  // released the task pool (i.e. spawned task) and read the arena's state. However, adding such a
501  // fence might hurt overall performance more than it helps, because the fence would be executed
502  // on every task pool release, even when stealing does not occur. Since TBB allows parallelism,
503  // but never promises parallelism, the missed wakeup is not a correctness problem.
504  pool_state_t snapshot = my_pool_state;
505  if( is_busy_or_empty(snapshot) ) {
506  // Attempt to mark as full. The compare_and_swap below is a little unusual because the
507  // result is compared to a value that can be different than the comparand argument.
508  if( my_pool_state.compare_and_swap( SNAPSHOT_FULL, snapshot )==SNAPSHOT_EMPTY ) {
509  if( snapshot!=SNAPSHOT_EMPTY ) {
510  // This thread read "busy" into snapshot, and then another thread transitioned
511  // my_pool_state to "empty" in the meantime, which caused the compare_and_swap above
512  // to fail. Attempt to transition my_pool_state from "empty" to "full".
513  if( my_pool_state.compare_and_swap( SNAPSHOT_FULL, SNAPSHOT_EMPTY )!=SNAPSHOT_EMPTY ) {
514  // Some other thread transitioned my_pool_state from "empty", and hence became
515  // responsible for waking up workers.
516  return;
517  }
518  }
519  // This thread transitioned pool from empty to full state, and thus is responsible for
520  // telling the market that there is work to do.
521 #if __TBB_ENQUEUE_ENFORCED_CONCURRENCY
522  if( work_type == work_spawned ) {
523  if( my_local_concurrency_mode ) {
524  __TBB_ASSERT(my_max_num_workers==1, "");
525  __TBB_ASSERT(!governor::local_scheduler()->is_worker(), "");
526  // There was deliberate oversubscription on 1 core for sake of starvation-resistant tasks.
527  // Now a single active thread (must be the master) supposedly starts a new parallel region
528  // with relaxed sequential semantics, and oversubscription should be avoided.
529  // Demand for workers has been decreased to 0 during SNAPSHOT_EMPTY, so just keep it.
530  my_max_num_workers = 0;
531  my_local_concurrency_mode = false;
532  return;
533  }
534  if ( as_atomic(my_global_concurrency_mode) == true )
535  my_market->mandatory_concurrency_disable( this );
536  }
537 #endif /* __TBB_ENQUEUE_ENFORCED_CONCURRENCY */
538  // TODO: investigate adjusting of arena's demand by a single worker.
539  my_market->adjust_demand( *this, my_max_num_workers );
540  }
541  }
542 }
543 
544 } // namespace internal
545 } // namespace tbb
546 
547 #endif /* _TBB_arena_H */
uintptr_t pool_state_t
Definition: arena.h:306
static int allocation_size(unsigned num_slots)
Definition: arena.h:291
unsigned my_num_workers_allotted
The number of workers that have been marked out by the resource manager to service the arena...
Definition: arena.h:143
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void * lock
The container for "fairness-oriented" aka "enqueued" tasks.
Definition: task_stream.h:69
unsigned my_max_num_workers
The number of workers requested by the master thread owning the arena.
Definition: arena.h:181
Base class for user-defined tasks.
Definition: task.h:604
A fast random number generator.
Definition: tbb_misc.h:130
Represents acquisition of a mutex.
Definition: spin_mutex.h:53
void const char const char int ITT_FORMAT __itt_group_sync s
void __TBB_EXPORTED_FUNC NFS_Free(void *)
Free memory allocated by NFS_Allocate.
static const intptr_t num_priority_levels
unsigned num_workers_active() const
The number of workers active in the arena.
Definition: arena.h:325
tbb::atomic< uintptr_t > my_pool_state
Current task pool state and estimate of available tasks amount.
Definition: arena.h:191
static generic_scheduler * local_scheduler()
Obtain the thread-local instance of the TBB scheduler.
Definition: governor.h:129
A lock that occupies a single byte.
Definition: spin_mutex.h:39
bool is_recall_requested() const
Check if the recall is requested by the market.
Definition: arena.h:330
void *__TBB_EXPORTED_FUNC NFS_Allocate(size_t n_element, size_t element_size, void *hint)
Allocate memory on cache/sector line boundary.
new_work_type
Types of work advertised by advertise_new_work()
Definition: arena.h:275
uintptr_t my_aba_epoch
ABA prevention marker.
Definition: arena.h:226
unsigned my_num_slots
The number of slots in the arena.
Definition: arena.h:241
Class representing where mail is put.
Definition: mailbox.h:96
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d int
static int unsigned num_arena_slots(unsigned num_slots)
Definition: arena.h:287
Work stealing task scheduler.
Definition: scheduler.h:137
#define GATHER_STATISTIC(x)
atomic< T > & as_atomic(T &t)
Definition: atomic.h:572
Pads type T to fill out to a multiple of cache line size.
Definition: tbb_stddef.h:261
T max(const T &val1, const T &val2)
Utility template function returning greater of the two values.
Definition: tbb_misc.h:114
void on_thread_leaving()
Notification that worker or master leaves its arena.
Definition: arena.h:385
atomic< unsigned > my_references
Reference counter for the arena.
Definition: arena.h:149
Used to form groups of tasks.
Definition: task.h:347
static void cleanup_worker(void *arg, bool worker)
Perform necessary cleanup when a worker thread finishes.
Definition: scheduler.cpp:1327
unsigned my_num_workers_soft_limit
Current application-imposed limit on the number of workers (see set_active_num_workers()) ...
Definition: market.h:78
The structure of an arena, except the array of slots.
Definition: arena.h:141
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
mail_outbox & mailbox(affinity_id id)
Get reference to mailbox corresponding to given affinity_id.
Definition: arena.h:296
int my_num_workers_requested
The number of workers that are currently requested from the resource manager.
Definition: arena.h:184
static void assume_scheduler(generic_scheduler *s)
Temporarily set TLS slot to the given scheduler.
Definition: governor.cpp:116
void try_destroy_arena(arena *, uintptr_t aba_epoch)
Removes the arena from the market&#39;s list.
Definition: market.cpp:332
void advertise_new_work()
If necessary, raise a flag that there is new job in arena.
Definition: arena.h:475
concurrent_monitor my_exit_monitors
Waiting object for master threads that cannot join the arena.
Definition: arena.h:254
atomic< unsigned > my_limit
The maximal number of currently busy slots.
Definition: arena.h:157
static bool is_busy_or_empty(pool_state_t s)
No tasks to steal or snapshot is being taken.
Definition: arena.h:322
unsigned my_num_reserved_slots
The number of reserved slots (can be occupied only by masters).
Definition: arena.h:244
task_stream< num_priority_levels > my_task_stream
Task pool for the tasks scheduled via task::enqueue() method.
Definition: arena.h:168
unsigned short affinity_id
An id as used for specifying affinity.
Definition: task.h:128
padded< arena_base > base_type
Definition: arena.h:272
void atomic_fence()
Sequentially consistent full memory fence.
Definition: tbb_machine.h:342
market * my_market
The market that owns this arena.
Definition: arena.h:223
static generic_scheduler * local_scheduler_if_initialized()
Definition: governor.h:139
The graph class.
argument_integer_type modulo_power_of_two(argument_integer_type arg, divisor_integer_type divisor)
A function to compute arg modulo divisor where divisor is a power of 2.
Definition: tbb_stddef.h:382

Copyright © 2005-2019 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.