Exercise 10.1

Consider the following algorithm.

increaseScore(studentId, assignmentId, delta)
    Set score = studentId's score for assignmentId.
    Update studentId's score for assignmentId to score+delta.
  1. Could a concurrent execution of this algorithm lead to violations of any of the transaction properties? If so, identify the properties and give a sample schedule; if not, explain why not.

  2. How would you fix the problems?

Exercise 10.2

Consider the following algorithm.

moveStudent(studentId, sourceSectionId, destinationSectionId)
    Compute size of destination section.
    If size < max
        Remove studentId from sourceSectionId.
        Add studentId to destinationSectionId.
  1. Could a concurrent execution of this algorithm lead to violations of any of the transaction properties? If so, identify the properties and give a sample schedule; if not, explain why not.

  2. How would you fix the problems?