Which code scheme is best suited for handling a round-robin and mutable workflow

My script is an application that cycles through real-time data and deadlines.

I have a series of actions to get data in each loop. I have actions that occur on each cycle (let them call them uppercase letters, for example A , B , C ..) and other actions that take place only every x cycles (let's call them lowercase letters, such as d , e , f , ...). An example of a stream template that has two continuous actions and one with a period of 3 cycles can be (the end of the cycle is marked with a "|"):

A - B - d | A - B | A - B | A - B - d | ...

In addition, the pattern may change at runtime according to user input. Therefore, some actions may be added or removed from the list. For example, the previous template, removing B , adding C after A and e after C with a period of 2 cycles, suddenly becomes (the change cycle is marked with the symbol “->”):

... | A - B - d | → A - d - C - e | A - C | A - C - e | A - d - C | A - C - e | A - C | A - d - C - e | ...

Right now I am starting manual threads that communicate with each other via WaitHandles and that in case of heavy action use Parallel.For. Then, when the template changes, I can, for example, stop a certain thread, start another one, replace WaitHandle, on which to wait ... I have problems with blocking when changing the template. I could fix them, but I came to the conclusion that it would be much better to have a more flexible solution, so if I need to change the template later, I already have all the tools to do this effectively.

I am new to this topic, but I think (following also what previoulsy suggested to me ) I need some kind of planner.

- Windows Workflow Foundation ( , ) , , , . , ? Scheduler ( , , )? ?

[EDIT]
, ( A, B,...) . ( d, e,...) . , A - B - d - e B A, d B e B, , , d. , ( , A B - ), . , ( A B). , - (, A , ).

+3
1

Windows .

CycleIteration = cycle ++% MaxCycleCount

, .

, :

0: A - B - d

1: A - B

2: A - B

3: A - B - d

...

Workflow . , .

Iteration FSM :

CycleIteration1Execute (...) {      (...);     callB (...);     callD (...);     ; }

.

( WF):

WF: , , 2 FSM.

http://www.codeproject.com/KB/dotnet/FirstStateMachineWorkflow.aspx

, M $( , , ):

http://msdn.microsoft.com/en-us/magazine/cc163281.aspx

, WF

http://odetocode.com/code/460.aspx

0

Source: https://habr.com/ru/post/1794760/


All Articles