CS5414 (Fall 2010) Homework 2
More on Causality and Clock Implementation

Due: 9:00am, 9/17/2010
Relative weight: 8 units

General Instructions. You are expected to work alone on this assignment.

Submit your solution using CMS. No late assignments will be accepted.

To facilitate grading, format your solutions as follows.

Solutions that do not satisfy the formatting guidelines will be returned, ungraded.


Problem 1

The distributed system in homework 1 was synchronous. In this problem, we consider a distributed system that is completely asynchronous. Assume that: Thus, no assumptions can be made about parameters D, DDmin, and DDmax in homework 1. Obviously, giving real-time execution bounds for programs that run in such a system is pointless, so nobody expects them.

(1.1) Describe an implementation of logical clocks for this distributed system. Your implementation must satisfy the two two requirements of a logical clock:

  1. Distinct events are assigned distinct logical timestamps.
  2. If an event E is potentially cause for another event F then TS(E) < TS(F).
Your implementation must satisfy the following:

(1.2) Argue that your implementation satisfies the two requirements of a logical clock:

  1. Distinct events are assigned distinct logical timestamps.
  2. If an event E is potentially cause for another event F then TS(E) < TS(F).


Problem 2

Recall that a vector clock VC maps each event E to a timestamp VC(E) and satisfies the following strong clock condition:
    E --> F if and only if VC(E) < VC(F)
Vector clocks are not the only method for implementing a mechanism that satisfies the strong clock condition, though.

A prime clock PC is constructed as follows. Assume that every processor i is assigned and knows a unique prime number pi. Assume also that each processor has a way to store integers that can grow arbitrarily large.

  1. Each processor i maintains a counter PCi, which is initially set to pi.
  2. Whenever a local event E occurs at processor i, the following is executed:
      PCi := PCi * pi
    The timestamp PC(E) of E is the value of PCi after the update.
  3. Whenever a send event E for a message m occurs at processor i, the following is executed:
      PCi := PCi * pi;
      timestamp TS(m) = PCi is included as part of m
    The timestamp PC(E) of E is the value of PCi after the update.
  4. Whenever a receive event for a message m occurs at processor i, the following is executed
      PCi := PCi * TS(m) * pi
    The timestamp PC(E) of E is the value of PCi after the update.
(2.1) Give an implementation for a relation "<" on values from prime clocks that causes values obtained from prime clocks to satisfy the strong clock condition. That is, give a procedure for computing whether PC(E) < PC(F) holds, such that
    E --> F if and only if PC(E) < PC(F)
is valid.

(2.2) Prove that prime clocks satisfy the weak clock condition:

    E --> F implies PC(E) < PC(F).

(2.3) EXTRA CREDIT Prove that prime clocks satisfy the strong clock condition:

    E --> F if and only if PC(E) < PC(F)

Hint for all parts: The Fundamental Theorem of Arithmetic asserts that every positive integer greater than 1 has a unique factorization as a product of prime numbers.