samedi 22 décembre 2018

How to make sure all cases are covered in an event-based concurrent setup?

In SICP 3.4.2 there is the problem of the order of events in the different processes.

Suppose we have two processes, one with three ordered events (a,b,c) and one with three ordered events (x,y,z). If the two processes run concurrently, with no constraints on how their execution is interleaved, then there are 20 different possible orderings for the events that are consistent with the individual orderings for the two processes.

20 orderings

As programmers designing this system, we would have to consider the effects of each of these 20 orderings and check that each behavior is acceptable. Such an approach rapidly becomes unwieldy as the numbers of processes and events increase.

Is there any tool / best practice which helps the programmer making sure every logically different cases are covered?

It would be nice if the programmer could define a set of events & constraints between them and the tool would return all the valid order of events (recognizing and grouping similar eg. looping patterns).

Given the list of possible event streams the programmer would be able to add/remove/modify the constraints.

The problem is important to me, because the most bug I have is related to some race condition or some not handled cases.

I don't really want to use a specific language with some advanced type system, I'd rather have a technology/language independent solution which acts as some kind of assistant - to design and document a system: with its events, constraints (and states).

It would be the holy grail to me.

I was searching for the solution across these topics: formal methods, formal verification, prolog (because of exhaustive search and logic), concurrency, dependent types, event-based programming, many types of testing, design by contract, cyclomatic complexity; but none of them gave me the answer. Furthermore, going deep into type theory seems to be an overkill.

Aucun commentaire:

Enregistrer un commentaire