What happens during Workflow Task Execution?

What happens during Workflow Task Execution? Is it a preparation step for the upcoming Workflow Execution step?

I believe this image describes execution of a most simple workflow, for example:

@Override // Workflow Method
public String greet(String name) {
     return "Hello " + name;

meaning it does not have any activity/child workflow executions, etc.

WorkflowExecutionStarted event indicates that a client has requested execution of this workflow.
Workflow task events (scheduled, started, completed) indicate execution of your workflow method up to a point it can no longer make any more progress (for example scheduling an activity invocation/child wf, or in this case just finishing on the return statement).
WorkflowExecutionCompleted event indicates completion of this workflow invocation.

If you ran this workflow, in the Web UI you would see similar corresponding events:

  1. WorkflowExecutionStarted (start execution of greet workflow method)
  2. WorkflowTaskScheduled
  3. WorkflowTaskStarted
  4. WorkflowTaskCompleted
  5. WorkflowExecutionCompleted (workflow exec completed)

2,3,4 are events produced by the single workflow task (execution of the return statement).

The docs image focuses on showing the exact time on where the workflow code is being progressed, which is i think useful.

See this post which has explanation of history events of a workflow that includes an activity invocation.

The one-before-last slide on this slide deck also includes a small animation that describes the flow between events and workflow code.