You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Unfortunately, Cpp-Taskflow is heavily relying on modern C++17's features/idoms/STL and it is very difficult to provide a version that compiles under older C++ versions.</p>
126
126
<h2><aclass="anchor" id="GeneralQuestion7"></a>
127
127
Q7: How does Cpp-Taskflow schedule tasks?</h2>
128
-
<p>Cpp-Taskflow has implemented different scheduler modules (centralized queue, proactive shceduler, speculative strategy, and work stealing). The default scheduler implements the famous <ahref="https://en.wikipedia.org/wiki/Work_stealing">work stealing algorithm</a> that has shown to behave efficiently in most multicore architectures. You can find the source code at <code>taskflow/threadpool/workstealing_threadpool.hpp</code></p><hr/>
128
+
<p>Cpp-Taskflow has implemented different scheduler modules (centralized queue, proactive shceduler, speculative strategy, and work stealing). The default scheduler implements the famous <ahref="https://en.wikipedia.org/wiki/Work_stealing">work stealing algorithm</a> that has shown to behave efficiently in most multicore architectures. You can find the source code at <code><aclass="el" href="executor_8hpp_source.html">taskflow/core/executor.hpp</a></code></p><hr/>
Q1: What is the difference between Cpp-Taskflow threads and workers?</h2>
133
133
<p>The master thread owns the thread pool and can spawn workers to run tasks or shutdown the pool. Giving taskflow <code>N</code> threads means using <code>N</code> threads to do the works, and there is a total of <code>N+1</code> threads (including the master threads) in the program.</p>
134
-
<divclass="fragment"><divclass="line"><aclass="code" href="classtf_1_1Executor.html">tf::Executor</a>(N); <spanclass="comment">// N workers, N+1 threads in the program.</span></div></div><!-- fragment --><p>If there is no worker threads in the pool, the master thread will do all the works by itself. Please refer to <aclass="el" href="chapter6.html#C6_MasterWorkersAndExecutor">Master, Workers, and Executor</a> for more details.</p>
134
+
<divclass="fragment"><divclass="line"><aclass="code" href="classtf_1_1Executor.html">tf::Executor</a>(N); <spanclass="comment">// N workers, N+1 threads in the program.</span></div></div><!-- fragment --><p>If there is no worker threads in the pool, the master thread will do all the works by itself. Please refer to C6_MasterWorkersAndExecutor for more details.</p>
Q2: What is the Lifetime of a Task and a Graph?</h2>
137
137
<p>The lifetime of a task sticks with its parent graph. A task is not destroyed until its parent graph is destroyed. Please refer to <aclass="el" href="chapter1.html#C1_LifetimeOfATask">Lifetime of A Task</a> for more details.</p>
Q4: My program hangs and never returns after dispatching a taskflow graph. What's wrong?</h2>
143
-
<p>When the program hangs forever it is very likely your taskflow graph has a cycle. Try the <aclass="el" href="classtf_1_1Taskflow.html#ac433018262e44b12c4cc9f0c4748d758" title="dumps the taskflow to a std::ostream in DOT format ">tf::Taskflow::dump</a> method to debug the graph before dispatching your taskflow graph.</p>
142
+
Q4: Is executor thread-safe?</h2>
143
+
<p>Yes, the executor object is thread-safe. You can have multiple threads run their taskflows on one executor.</p>
Q5: In the following example where B spawns a joined subflow of two tasks B1 and B2, do they run concurrently with task A?</h2>
145
+
Q5: My program hangs and never returns after dispatching a taskflow graph. What's wrong?</h2>
146
+
<p>When the program hangs forever it is very likely your taskflow graph has a cycle. Try the <aclass="el" href="classtf_1_1Taskflow.html#ac433018262e44b12c4cc9f0c4748d758" title="dumps the taskflow to a std::ostream in DOT format ">tf::Taskflow::dump</a> method to debug the graph before dispatching your taskflow graph.</p>
0 commit comments