[great-users] Undefined Semantics
Attila Vizhanyo
viza at isis.vanderbilt.edu
Mon Jan 5 22:22:17 CST 2004
Abdul,
The execution order of parallel rules is undeterministic indeed,
but passing deleted objects between rules is recipe for disaster.
As an analogy, imagine you pass and use deleted pointers between C/C++
functions.
The general problem you see is the concurrent use of resources between
processes, where pattern objects are the resources shared by rules
R1 and R2. Rest assured, the notion of concurrent resource acquisition
is not addressed in the GReAT language, so be careful about these
issues.
Similarly, if you update the attributes of a pattern object via
Attribute mapping code in R1, R2 will receive that updated object.
Concerning the stability of the generated code on null object
references, the generated pattern matcher code checks each input object
of being the particular input type specified by the rule. This Udm
member function: type(), will throw an udm exception for null objects.
Pretty this ain't, but explicit null checking of each input object would
be tedious and more importantly expensive in run-time performance.
However, objects to be deleted are checked to be valid prior to object
deletion in the generated effector code, so if you delete an object
twice inside a rule, the generated code will utter not a whimper.
-Attila
-----Original Message-----
From: Abdullah Sowayan
Sent: Monday, January 05, 2004 18:18
To: great-users at list.isis.vanderbilt.edu
Subject: [great-users] Undefined Semantics
Hi Ya'll
I couldn't find the semantics of the following situation in the
documentation. Assume that I have a block (B) that has one input port.
Inside the block I have two rules (R1 and R2) each have one input port.
R1 and R2 input ports are connected to B's input port. R1 and R2 are
parallel, hence the order of their execution is undeterministic.
R1 and R2 both delete the input packet they get. Thus, if the order of
execution is R1 then R2, by R1 will delete the incoming packet; thus
when R2 executes its packet will have a null reference. R2 will try to
bind with a null reference and ultimately delete it. Is there a check
against binding against null reference (so that rule won't crash?).
If the above doesn't make sense, please contact me and I'll try to
explain it further.
Take care,
Abdul
_______________________________________________
great-users mailing list
great-users at list.isis.vanderbilt.edu
http://list.isis.vanderbilt.edu/mailman/listinfo/great-users
More information about the great-users
mailing list