workflowfm / proter

A discrete event simulator for asynchronous prioritized processes
http://docs.workflowfm.com/proter
Apache License 2.0
1 stars 0 forks source link

Simulation "Pre-Firing" #8

Closed MBaczun closed 4 years ago

MBaczun commented 4 years ago

alt text Here's the scenario: an And containing two Thens. In terms of the order in which tasks are added to the coordinator, first A and C would be added, once the future of A completes then B is added, once C completes D is added. But I'm concerned as to what happens if both A and C complete at the same time. If I find that A has completed, how can I be certain that I can call ready()? If only A completes, then I can check with something like A.onComplete{_=> if ( ! C.isComplete ) { //add task can call ready() } }, and similar for just C completing, however if A and C complete on the same time step, then it is possible that the A.onComplete segment is activated before C is registered as completing, and so I might add B to the coordinator but not D, while I should be adding both. I can't wait for C to complete, because that might not happen until the next time step. I can't be certain that I have the latest information, maybe the thread that computes C is slower than the one that computes A so there is a delay big enough to call ready() prematurely. What can I do?

This is how I understand the control flow of the system: alt text If this is correct, then perhaps fundamentally the problem is that we issue out tasks in one bulk message but we receive replies for each task individually. The coordinator is no better suited to tackle the issue because it faces the same challenge, so maybe the scheduler can be modified? Edit: this is wrong

Possible solutions:

MBaczun commented 4 years ago

Acking each task individually (sending ready() multiple times) has proven to be effective in enabling the implementation of Flows.

PetrosPapapa commented 4 years ago

9 should now help resolve this! 😃

MBaczun commented 4 years ago

The implementation of callbacks in addition to #9 has now resolved this issue.