[P4-discuss] Question regarding semantics of actions in P4-14 (v1.0.3)

Nate Foster jnfoster at cs.cornell.edu
Thu Jan 19 05:15:10 EST 2017

Hi Ali,

It's almost like one needs to formalize the semantics to make sense of
this! ;-)

I wasn't involved with drafting the P4-14 spec so I could be wrong, but
based on the informal text, I believe the intention is that the order of
the statements is ignored, but the primitive instructions are executed with
something akin to "true concurrency" and what Lamport calls "regular" in
his classic work on semantics of registers. That is, after executing a the
field h.a would either have the value 1 or 2, but not some other value
(which weaker notions like "safe registers" allow, due to hazards that may
occur when shared memory is written by two different threads

The way I would model this in an operational semantics is to (i) copy the
old state before evaluating the primitives in the action body and (ii)
define a merge operation that takes the updated states produced by
evaluating the primitives and (non-deterministically) merges them to get a
new state.

Maybe Nikolaj can weigh in on how P4-NoD handled this issue?


On Wed, Jan 18, 2017 at 11:59 AM, Ali Kheradmand <a.i.kheradmand at gmail.com>

> Hi,
> In the language specification version 1.0.3, section 9.2.1 it is stated
> that “P4 assumes parallel semantics for the application of all the
> primitive actions executing as a result of a match in a given table.” It
> also mentions that “With parallel semantics, […] actions are started at the
> same time”.
> I was wondering whether it means that the order of actions are not
> important at all or not. If the order is ignored, I what happens if two
> primitive actions that are executed as a result of a match have overlapping
> effects, for example:
> action a  ( ) {
>   modify_field(h.a, 1);
>   modify_field(h.a, 2);
> }
> If the order is important, how exactly it relates to the parallel
> semantics?
> Regards,
> Ali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-discuss_lists.p4.org/attachments/20170119/e346096e/attachment-0002.html>

More information about the P4-discuss mailing list