4 The sequence concept

The order of coupling operations in the system is determined solely by the order of calls to send (oasis_put or “put”) and receive (oasis_get or “get”) data in the components in conjunction with the setting of the lag in the namcouple. Data that is received is always blocking while data that is sent is non-blocking with respect to the component making that call. It is possible to deadlock the system if the relative orders of puts and gets in different components are not compatible.

With OASIS3-MCT, the sequence (SEQ) index in the namcouple file now provides the coupling layer with an ability to detect a deadlock before it happens and exit. It does this by tracking the order of get and put calls in components compared to the SEQ specified in the namcouple. If there are any inconsistencies, the component will abort gracefully with a useable error message before the system deadlocks. If there are any coupling dependencies in the system, use of the SEQ index is recommended for diagnosis but has no impact on the ultimate solution and is NOT required.

In the following two examples, there are two models, each “put" a field to the other at every coupling period without any lags. In the first case, there is no dependency as each model first sends and then receives some data.

     model1        model2
     ------        ------
    put(fld1)     put(fld2)
    get(fld2)     get(fld1)

In this case, there is no sequencing dependency and the value of SEQ must be identical (or unset) in the namcouple description of the fld1 and fld2 coupling. If by mistake, SEQ is set to 1 for fld1 and 2 for fld2, then the coupled model will abort because at runtime, the coupler will detect in model 2 that fld2 was sent before fld1 was received which is out of sequence as defined by the SEQ settings.

In the next example, there is a dependency in the sequencing.

     model1        model2
     ------        ------
    put(fld1)     get(fld1)
                  fld2=g(fld1)
    get(fld2)     put(fld2)

In model2, fld2 depends on fld1. If SEQ is not used and if, for example, model1 does not have the consistent ordering of the put and get shown above (required by model2), then the models would deadlock and hang. If this dependency is known, there is a benefit in setting SEQ=1 for fld1 and SEQ=2 for fld2; at runtime, if the sequencing of model1 or model2 does not match the above diagram, then the coupling layer will detect it and will exit gracefully with an error message.

Again, the SEQ namecouple setting is only diagnostic and is not required.