1

When designing models in Promela, what are the design trade-offs for channels when there are a many different types of messages being sent?

Many examples in documentation use a simple case with something like this

mtype { M1, M2, M3 }
chan req = [0] of { mtype, chan, byte};

However in practice some models may have processes that handle a wide variety of different message types, each of which have a unique set of parameters.

So there seems to be a design decision between channels that can represent the parameters of a variety of message types:

mtype { M1, M2, M3 }
chan req = [0] of { mtype, chan, byte, int, byte, etc...};

and channels specific to each message type

chan req1 = [0] of { chan, byte };
chan req2 = [0] of { chan, int };
chan req3 = [0] of { chan, byte, int};

I'm interested in understand any performance benefits to one design over the other, and what is considered best practices.

Noah Watkins
  • 5,446
  • 3
  • 34
  • 47
  • I know nothing of *best practices*, but: **1.** A `struct` would be more easily maintainable than that long list of arguments used in the first approach. **2.** If *asynchronous* channels are used, the second approach does not guarantee that messages are served in the proper order. I am not sure whether this is the case with *synchronous* channels or not. – Patrick Trentin Nov 15 '17 at 11:52

0 Answers0