40 *
41 * It is described in the paper:
42 * "Wessam Hassanein. 2016. Understanding and improving JVM GC work
43 * stealing at the data center scale. In Proceedings of the 2016 ACM
44 * SIGPLAN International Symposium on Memory Management (ISMM 2016). ACM,
45 * New York, NY, USA, 46-54. DOI: https://doi.org/10.1145/2926697.2926706"
46 *
47 * Instead of a dedicated spin-master, our implementation will let spin-master relinquish
48 * the role before it goes to sleep/wait, allowing newly arrived threads to compete for the role.
49 * The intention of above enhancement is to reduce spin-master's latency on detecting new tasks
50 * for stealing and termination condition.
51 */
52 class TaskTerminator : public CHeapObj<mtGC> {
53 uint _n_threads;
54 TaskQueueSetSuper* _queue_set;
55
56 DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, 0);
57 volatile uint _offered_termination;
58 DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile uint));
59
60 #ifdef ASSERT
61 bool peek_in_queue_set();
62 #endif
63 void yield();
64
65 Monitor* _blocker;
66 Thread* _spin_master;
67
68 // If we should exit current termination protocol
69 bool exit_termination(size_t tasks, TerminatorTerminator* terminator);
70
71 size_t tasks_in_queue_set() const;
72
73 // Perform spin-master task.
74 // Return true if termination condition is detected, otherwise return false
75 bool do_spin_master_work(TerminatorTerminator* terminator);
76
77 NONCOPYABLE(TaskTerminator);
78
79 public:
80 TaskTerminator(uint n_threads, TaskQueueSetSuper* queue_set);
81 ~TaskTerminator();
82
|
40 *
41 * It is described in the paper:
42 * "Wessam Hassanein. 2016. Understanding and improving JVM GC work
43 * stealing at the data center scale. In Proceedings of the 2016 ACM
44 * SIGPLAN International Symposium on Memory Management (ISMM 2016). ACM,
45 * New York, NY, USA, 46-54. DOI: https://doi.org/10.1145/2926697.2926706"
46 *
47 * Instead of a dedicated spin-master, our implementation will let spin-master relinquish
48 * the role before it goes to sleep/wait, allowing newly arrived threads to compete for the role.
49 * The intention of above enhancement is to reduce spin-master's latency on detecting new tasks
50 * for stealing and termination condition.
51 */
52 class TaskTerminator : public CHeapObj<mtGC> {
53 uint _n_threads;
54 TaskQueueSetSuper* _queue_set;
55
56 DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, 0);
57 volatile uint _offered_termination;
58 DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile uint));
59
60 void assert_queue_set_empty() const NOT_DEBUG_RETURN;
61
62 void yield();
63
64 Monitor* _blocker;
65 Thread* _spin_master;
66
67 // If we should exit current termination protocol
68 bool exit_termination(size_t tasks, TerminatorTerminator* terminator);
69
70 size_t tasks_in_queue_set() const;
71
72 // Perform spin-master task.
73 // Return true if termination condition is detected, otherwise return false
74 bool do_spin_master_work(TerminatorTerminator* terminator);
75
76 NONCOPYABLE(TaskTerminator);
77
78 public:
79 TaskTerminator(uint n_threads, TaskQueueSetSuper* queue_set);
80 ~TaskTerminator();
81
|