Comp150CPA: Clouds and Power-Aware Computing
Classroom Exercise 2
Consistency and Concurrency
Spring 2011
group member 1: ____________________________ login: ______________
group member 2: ____________________________ login: ______________
group member 3: ____________________________ login: ______________
group member 4: ____________________________ login: ______________
group member 5: ____________________________ login: ______________
In class we have studied the concepts of strong and weak
(eventual) consistency and strong and weak (optimistic) concurrency.
Let's explore a few aspects of these concepts.
- Why are concurrency and consistency not typically a problem when
creating and storing new individual entities?
- On twitter, when you create an account, it does not appear in
searches for a while. From the user's point of view, are twitter
account objects strongly or eventually consistent? Why?
- With a two-column concurrency diagram like the one used in
lecture, with two application instances in columns and time increasing
in Y, demonstrate how naively changing the name "John Smith" to "Jon
Smythe" in one instance of an application, without using transactions,
can result in printing the name "Jon Smith" in another instance of
the application(the access methods are called setFirstName(String),
getFirstName(), setLastName(String), getLastName()).
- Still considering the above situation, describe how begin() and
commit() calls should be placed to circumvent the problem. Then
exhibit another two-column concurrency diagram (with two application
instances) that causes the transaction that is trying to change the
first and last name together to throw an exception.
- (Advanced) Is it possible to construct a cloud datastore
so that changes to attributes other than the accessed or changed
attributes between a begin() and a commit() do not cause consistency
exceptions? Why or why not?