Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Nav
New Contributor I
59 Views

Successor or predecessor

Jump to solution
I'm getting really confused as to what the below paragraph means, so I'm assuming that the writer of the tutorial actually meant to write "predecessor" instead of "successor". Especially so, coz Figure 7 of the fibonacci example shows all task arrows pointing upward.

11.4 How Task Scheduling Works
The scheduler evaluates a task graph. The graph is a directed graph where each node
is a task. Each task points to its successor, which is another task that is waiting on it
to complete, or NULL. Method task::parent() gives you read-only access to the
successor pointer. Each task has a refcount that counts the number of tasks that have
it as a successor. The graph evolves over time.

So is it supposed to be "predecessor"?
0 Kudos

Accepted Solutions
Alexey_K_Intel3
Employee
59 Views
No, it's really supposed to be "successor", in the sense of a task that may start or continue execution only after the given task completes. The successortask can bethe predecessor as well, but it's less important in that context.

View solution in original post

4 Replies
Alexey_K_Intel3
Employee
60 Views
No, it's really supposed to be "successor", in the sense of a task that may start or continue execution only after the given task completes. The successortask can bethe predecessor as well, but it's less important in that context.

View solution in original post

Nav
New Contributor I
59 Views
Oh...got it! "successor" was to be considered in the order of execution, and not in the order of creation.
The leaf tasks get executed first.
I understand your mention of "The successortask can bethe predecessor as well" happens when a task is stolen by another thread.
Alexey_K_Intel3
Employee
59 Views
Quoting Nav
I understand your mention of "The successortask can bethe predecessor as well" happens when a task is stolen by another thread.


Actually stealing isorthogonal here.
I meant that the"parent" task can create "child" tasks, spawn those, and wait for their completion - in this case it's both predecessor and successor. However a parent task may as wellcreate a separate successor task that will execute after competion of children; we also call it "continuation task". In this case, the parent task is the predecessor for its children, and the continuation task is the successor. See section 11.5.2 "Continuation passing" in the Tutorial.

Also as you may guess from the above, "leaf tasks get executed first" is not totally correct as well. It's really a dynamic tree of tasks that create and spawn other tasks during the execution, and may or may not explicitly wait for completion of those.

Nav
New Contributor I
59 Views
Honestly, it's quite a challenge visualising the concept even with the tutorial's examples; but your reply gave me a bit more headway into understanding how tasks work. Thanks.