1.. _When_Task-Based_Programming_Is_Inappropriate:
2
3When Task-Based Programming Is Inappropriate
4============================================
5
6
7Using the task scheduler is usually the best approach to threading for
8performance, however there are cases when the task scheduler is not
9appropriate. The task scheduler is intended for high-performance
10algorithms composed from non-blocking tasks. It still works if the tasks
11rarely block. However, if threads block frequently, there is a
12performance loss when using the task scheduler because while the thread
13is blocked, it is not working on any tasks. Blocking typically occurs
14while waiting for I/O or mutexes for long periods. If threads hold
15mutexes for long periods, your code is not likely to perform well
16anyway, no matter how many threads it has. If you have blocking tasks,
17it is best to use full-blown threads for those. The task scheduler is
18designed so that you can safely mix your own threads with |full_name| tasks.
19
20