Difficulty |
3 |
Reading material |
Create a task scheduler that is parameterized in the number of threads to use.
Let’s call this parameter thread_count
.
The scheduler should divide the given lists of tasks in thread_count
sublists of (approximately) equal size.
Next, it should fire up thread_count
threads and give each thread one of these sublists.
We say this scheduler is unbalanced because, although the tasks are distributed evenly, it is possible that some tasks involve more work than others. For example, there could be an unlucky thread that gets 10× the work of the others: it would have to trudge on alone. A balanced scheduler would have the other threads come to its aid.
Implement the task scheduler described above. Make it available through a factory function
|
1. Evaluation
|