Janus Dam Nielsen <[EMAIL PROTECTED]> writes:

> Den 07/12/2007 kl. 14.34 skrev Martin Geisler:
>
>> I see what you mean about the observer pattern since each variable in
>> the program is observed by the operations that depend on it. So
>>
>>   x = add(a, b)
>>   y = mul(a, b)
>>   z = add(x, y)
>>
>> would create an add operation that observes the a and b variables and
>> a mul operation that does the same. Finally, an add operation would
>> observe x and y and notify z.
>>
>> When a and b get a value (from incoming network traffic) they notify
>> their listeners. The add and mul operations could then proceed by
>> having x, respectively y, notify their listeners which would be the
>> add operation defining z in this example.
>
> By the way I really like this way of looking at the computations as
> just observing on the results, it has some huge advantages in a
> parallel world! Good work Martin!

Thanks!

I think of the calculation as a big network of operators. The values
flow through this network and are transformed as they pass through an
operator node. The network is actually an acyclic directed graph like
this one random example where x and y are multiplied, opened and
squared. At the same time (in parallel) a and b are created using PRSS
and added, and b is multiplied by 2 and opened.

   ...        ...   ...
    |          |     |
  sqrt()       +   open()
    |         / \    |
  open()     /   \   *
    |       /     \ / \
    *      a       b   2
   / \     |       |
  x   y  prss()  prss()

More stuff might happen later with the top three outgoing edges.

This is the kind of structure that VIFF builds and evaluates using the
Twisted Deferreds.

As you say, it is then easy to evaluate such a graph in parallel as long
as you keep track of the leaf nodes. By parallel I don't necessarily
mean having multiple threads running on a single party -- one could also
evaluate the graph in parallel by starting the next operations before
the first was finished.

In our example, the multiplication could be done and the shares sent
out. Before the others parties send us their shares, we would go on to
the first prss() and then the second prss() operation.

This is what VIFF does: it keeps evaluating all the nodes that can be
evaluated. This is done in a single thread which simplifies things
because no locking or synchronization is needed.

--
Martin Geisler

Attachment: pgpCUDPzxeQnq.pgp
Description: PGP signature

_______________________________________________
viff-devel mailing list (http://viff.dk/)
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk

Reply via email to