Terms and Concepts
An active object is an object that owns a process or thread and can initiate control activity. An active class is a class whose instances are active objects. A process is a heavyweight flow that can execute concurrently with other processes. A thread is a lightweight flow that can execute concurrently with other threads within the same process. Graphically, an active class is rendered as a rectangle with double lines for left and right sides. Processes and threads are rendered as stereotyped active classes (and also appear as sequences in interaction diagrams).
Interaction diagrams are discussed in Chapter 19 . |
Flow of Control
In a purely sequential system, there is one flow of control. This means that one thing, and one thing only, can take place at a time. When a sequential program starts, control is rooted at the beginning of the program and operations are dispatched one after another. Even if there are concurrent things happening among the actors outside the system, a sequential program will process only one event at a time, queuing or discarding any concurrent external events.
Actors are discussed in Chapter 17 . |
Actions are discussed in Chapter 16 . |
Nodes are discussed in Chapter 27 . |
Classes and Events
Active classes are just classes, albeit ones with a very special property. An active class represents an independent flow of control, whereas a plain class embodies no such flow. In contrast to active classes, plain classes are implicitly called passive because they cannot independently initiate control activity.
Classes are discussed in Chapters 4 and 9 . |
Objects are discussed in Chapter 13; attributes and operations are discussed in Chapter 4; relationships are discussed in Chapters 4 and 10; extensibility mechanisms are discussed in Chapter 6; interfaces are discussed in Chapter 11 . |
State machines are discussed in Chapter 22; events are discussed in Chapter 21 . |
Communication
When objects collaborate with one another, they interact by passing messages from one to the other. In a system with both active and passive objects, there are four possible combinations of interaction that you must consider.
Interactions are discussed in Chapter 16 . |
Signal events and call events are discussed in Chapter 21 . |
Figure 23-2. Communication

Constraints are discussed in Chapter 6 . |
Synchronization
Visualize for a moment the multiple flows of control that weave through a concurrent system. When a flow passes through an operation, we say that at a given moment, the locus of control is in the operation. If that operation is defined for some class, we can also say that at a given moment, the locus of control is in a specific instance of that class. You can have multiple flows of control in one operation (and therefore in one object), and you can have different flows of control in different operations (but still result in multiple flows of control in the one object).The problem arises when more than one flow of control is in one object at the same time. If you are not careful, more than one flow might modify the same attribute, corrupting the state of the object or losing information. This is the classical problem of mutual exclusion. A failure to deal with it properly yields all sorts of race conditions and interference that cause concurrent systems to fail in mysterious and unrepeatable ways.The key to this problem is serialization of access to the critical object. There are three approaches, each of which involves attaching certain synchronization properties to the operations defined in a class. In the UML, you can model all three approaches.
Figure 23-3. Synchronization
