@startuml{master-slave-messages.png}
== task execution ==
loop calculation tasks
    hnote over Master : define task

    Master -> Slave: TAG_NEW_TASK
    activate Slave
    hnote over Slave : calculation
    alt successful
        Slave --> Master: TAG_NEW_RESULT
    else calculation failed
        Slave --> Master: TAG_INVALID_RESULT
    else critical error
        Slave --> Master: TAG_ERROR_ABORTING
    end
    deactivate Slave

    hnote over Master : collect results
end
...
== termination ==
Master -> Slave: TAG_FINISH
destroy Slave
@enduml
