Re: Observer pattern limitations



On Fri, 14 Jul 2006 14:29:25 -0500, Leslie Sanford wrote:

Here is an example that can cause a problem:

---------------->

+---+out
| B |--+
+---+ |
+---+ out |in | in+---+out
| A |-------+ +---| D |---->
+---+ |in | +---+
+---+ |
| C |--+
+---+out

So how can this be solved?

[snip]

There exist other solutions as well.

1. In the data-flow language I designed, D is triggered by an expression
@B~@C, which has the semantics: "both time stamps have been incremented."
This kills the race condition between B and C.

2. In synchronous data-flow languages (my is asynchronous) like Simulink,
there is no problem at all, because D(n+1) takes B(n) and C(n) from the
state vector of the previous step.

3. Note that if you have DAG, you can always order nodes according to the
graph distance, that will guaranty you a correct execution order.

P.S. Many things stop to work if cells have memory access clock. And they
will if you'll implement digital filters. It is nasty.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.