Homework 2 Solutions
- Reflexivity is trivial.
- Antisymmetry: Let A and B be two students, and let c be a course. If A ≤ B then B has a grade no worse than B in course c. Simlarly, if B ≤ A then A has a grade no worse than A in course c. Thus, since source grades are a total order A and B must have the grade in course c. Thus A and B must have the same grade in every course, so their grades are identical.
- Transitivity: An argument similar to the once above for antisymmetry shows that course grades are symmetric.
-
Such an "epoch-based" logical clock would put every event in a "later" (higher-numbered) epoch at a later time stamp than any event in an earlier (lower-numbered) epoch.
Thus, every every event in an earlier epoch is considered to have "happened before" every event in in a later epoch, regardless of the actual relationship carried by messages.
The effect is the same as if a barrier had occured after each epoch, even if no such barrier was implemented.
-
- Each node calculates a local maximum M.
The initial value of the local maximum M is the value associated with the node.
When a node sends any message it includes the value of its local maximum M in the message.
When a nodes receives any message, it replaces its local maximum M with the
maximum of the value included in the message and the current value of M.
The result will be that the local maximum at the initiator will be the maximum of the values associated with all nodes at termination.
-
The calculation of a sum works much like the calculation of a maximum described above, except that the message sent by a parent to each of its children should contain zero. Rather than calculating a local maximum, each node calculates a local sum, initially equal to the value associated with the name. When all neighbors have responded, the value its returned it to the node's parent. At termination, the local sum of the initiator is the sum of the values associated with all nodes.