PART III TRANSACTIONS
Chapter 17 Composite operations
Objectives
To extend the study of atomic operations to those which comprise lower level atomic operations. To study the problems deriving from concurrent execution and crashes.
Points to emphasise
- We assume that concurrency control at the level of a single operation (to achieve atomic execution) is enforced by some means as described in Part II.
- An operation which is meaningful at some level may comprise lower level operations that already exist as atomic operations in their own right.
- It is desirable, to achieve high performance, to allow concurrent (interleaved) execution of the components of high level operations.
- Uncontrolled concurrent execution can lead to incorrect system state and incorrect output to the client.
- An attempt, based on locking, to control the interleaving and avoid these problems can lead to deadlock.
- A crash part way through a composite operation can leave persistent state inconsistent. Some sub-operations have completed, some haven’t.
- We shall use the object model introduced here as a basis for reasoning throughout Part III. It is set up in more detail in Chapter 18.
Possible difficulties
The conceptual difficulty lies in considering levels of atomicity. In Part II we constructed atomic operations from a number of machine instructions. We are now constructing higher level atomic operations from atomic operations. Why are the problems different? Because we do not execute (implement) the high level composite operation as a single atomic operation but allow the execution of its components to be interleaved.
The material should be straightforward at a superficial level as it is just setting up problems that we have to solve.
Teaching hints
- Ask the students why we shouldn’t implement the execution of every meaningful operation, however high level, as an atomic operation. Get them to convince themselves that interleaved execution is a good thing to aim for. Draw on familiar examples from DB. Speculate on the performance of an OS that single-threads through every composite operation.
- Discuss concurrency control (done in Part II) and crash recovery for Chapter 14’s single atomic operation.
- Discuss the likelihood of conflict in practical examples. Prepare the ground for a later discussion of pessimistic and optimistic approaches to concurrency control.
- Deadlock is traditionally introduced with the Part II material. It may be of interest to say so and to give examples from OS and concurrent programming. Or wait until the next chapter.
- Cover the object model in the example in Section 16.5 to prepare the ground for later chapters.