Mutual Exclusion

Here we show an example of concurrent access by two processes (threads, active objects and other terminology are commonly used) to illustrate how inconsistencies arise if we permit arbitrary sequences of accesses to shared resources.. Take the parts database we described partly in chapter 1. If two customer sites wished to order a part from some particular warehouse, the sequence of operations each would execute might be as in #tbmutex#328>.

#table329#
Table: Mutual Exclusion

Now the problem is that the Database is shared, and if two Clients access the data in an arbitrarily interleaved sequence of operations, the data become inconsistent, or the client gets inconsistent replies. In the next chapter, we will see how transactions are used as the general mechanism to hide these kinds of problems through the notion of <#332#> atomic actions<#332#>.