Skip to content

Commit 02e1af3

Browse files
updated docs
1 parent 1442c23 commit 02e1af3

76 files changed

Lines changed: 286 additions & 1021 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/Cookbook.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
<a class="el" href="chapter3.html">C3: Create a Parallel For-loop Graph</a> <br />
110110
<a class="el" href="chapter4.html">C4: Create a Parallel Reduction Graph</a> <br />
111111
<a class="el" href="chapter5.html">C5: Spawn Task Dependency Graphs at Runtime</a> <br />
112-
<a class="el" href="chapter6.html">C6: Manage Threads and Executor</a> <br />
113112
</p>
114113
</div></div><!-- contents -->
115114
</div><!-- doc-content -->

docs/Cookbook.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ var Cookbook =
1818
[ "C2: Execute a Taskflow", "chapter2.html", [
1919
[ "Graph and Topology", "chapter2.html#GraphAndTopology", null ],
2020
[ "Create an Executor", "chapter2.html#C2_CreateAnExecutor", null ],
21-
[ "Execute a Taskflow", "chapter2.html#C2_ExecuteATaskflow", null ]
21+
[ "Execute a Taskflow", "chapter2.html#C2_ExecuteATaskflow", null ],
22+
[ "Thread Safety", "chapter2.html#C2_ThreadSafety", null ],
23+
[ "Monitor Thread Activities", "chapter2.html#C2_MonitorThreadActivities", null ],
24+
[ "Customize Your Own Observer", "chapter2.html#C2_CustomizeYourOwnObserver", null ]
2225
] ],
2326
[ "C3: Create a Parallel For-loop Graph", "chapter3.html", [
2427
[ "Range-based For-loop", "chapter3.html#RangeBasedForLoop", null ],
@@ -39,11 +42,5 @@ var Cookbook =
3942
[ "Subflow", "chapter5.html#Subflow", null ],
4043
[ "Detach a Subflow", "chapter5.html#DetachASubflow", null ],
4144
[ "Nested Subflow", "chapter5.html#NestedSubflow", null ]
42-
] ],
43-
[ "C6: Manage Threads and Executor", "chapter6.html", [
44-
[ "Master, Workers, and Executor", "chapter6.html#C6_MasterWorkersAndExecutor", null ],
45-
[ "Thread Safety", "chapter6.html#C6ThreadSafety", null ],
46-
[ "Monitor Thread Activities", "chapter6.html#C6MonitorThreadActivities", null ],
47-
[ "Customize Your Own Observer", "chapter6.html#C6CustomizeYourOwnObserver", null ]
4845
] ]
4946
];

docs/FAQ.html

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,27 @@ <h2><a class="anchor" id="GeneralQuestion6"></a>
125125
<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>
126126
<h2><a class="anchor" id="GeneralQuestion7"></a>
127127
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 <a href="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 <a href="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><a class="el" href="executor_8hpp_source.html">taskflow/core/executor.hpp</a></code> </p><hr/>
129129
<h1><a class="anchor" id="ProgrammingQuestions"></a>
130130
Programming Questions</h1>
131131
<h2><a class="anchor" id="ProgrammingQuestions1"></a>
132132
Q1: What is the difference between Cpp-Taskflow threads and workers?</h2>
133133
<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-
<div class="fragment"><div class="line"><a class="code" href="classtf_1_1Executor.html">tf::Executor</a>(N); <span class="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 <a class="el" href="chapter6.html#C6_MasterWorkersAndExecutor">Master, Workers, and Executor</a> for more details.</p>
134+
<div class="fragment"><div class="line"><a class="code" href="classtf_1_1Executor.html">tf::Executor</a>(N); <span class="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>
135135
<h2><a class="anchor" id="ProgrammingQuestions2"></a>
136136
Q2: What is the Lifetime of a Task and a Graph?</h2>
137137
<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 <a class="el" href="chapter1.html#C1_LifetimeOfATask">Lifetime of A Task</a> for more details.</p>
138138
<h2><a class="anchor" id="ProgrammingQuestions3"></a>
139139
Q3: Is taskflow thread-safe?</h2>
140140
<p>No, the taskflow object is not thread-safe. You can't create tasks from multiple threads at the same time.</p>
141141
<h2><a class="anchor" id="ProgrammingQuestions4"></a>
142-
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 <a class="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>
144144
<h2><a class="anchor" id="ProgrammingQuestions5"></a>
145-
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 <a class="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>
147+
<h2><a class="anchor" id="ProgrammingQuestions6"></a>
148+
Q6: In the following example where B spawns a joined subflow of two tasks B1 and B2, do they run concurrently with task A?</h2>
146149
<div class="image">
147150
<img src="dynamic_graph.png" alt="dynamic_graph.png" width="60%"/>
148151
</div>

0 commit comments

Comments
 (0)