Lock Entities
The system uses three distinct entities to track contention for database resources:
How the System Detects a Deadlock
The mechanism used to detect a deadlocked task is the same for both DC/UCF system resources and database resources.
Deadlock detection is carried out in these major phases:
The task running for the shortest period of time is chosen as the victim because most likely is has consumed fewer resources than a longer running task. As a result, less duplication of work should be required when the victim is restarted, with these exceptions:
Victim Selection User Exit
The algorithm used to select a victim in a deadlock situation may not be optimal for your installation or applications. A user exit is provided to allow victims to be selected based upon your requirements. The exit is passed the TCE addresses of each pair of deadlocked tasks and may take one of two actions:
Note: For more information about the Victim Selection user exit, see the CA IDMS System Operations Guide.
Detecting Deadlocks
The following figure illustrates how the deadlock detection mechanism detects deadlocks.
Task A is using resource 1. ┌─────────┐ ┌─────────┐ │ │ │ │ Task B is using resource 2. │ Task A │ │ Task B │ └────▲────┘ └────▲────┘ A lock is created for │ │ resource 1 and resource 2. │ │ ┌────┴────┐ ┌────┴────┐ │ Lock │ │ Lock │ Every lock is connected to │ A-1 │ │ B-2 │ the task that owns └────▲────┘ └────▲────┘ the resource. │ │ │ │ ┌────┴────┐ ┌────┴────┐ │ Resource│ │ Resource│ │ 1 │ │ 2 │ └─────────┘ └─────────┘ -------------------------------------------------------------------------------- Task A requests resource 2. ┌─────────┐ ┌─────────┐ │ │ │ │ A lock wait is created to │ Task A │ │ Task B │ indicate that task A is └─▲─────┬─┘ └────▲────┘ waiting on resource 2. │ │ │ │ │ │ Task A points to the ┌────────┴┐ ┌─▼───────┐ ┌────┴────┐ lock wait for resource 2. │ Lock │ │Lock wait│ │ Lock │ The lock wait points to │ A-1 │ │ A-2 │ │ B-2 │ resource 2 to indicate └────▲────┘ └────┬────┘ └────▲────┘ the resource it is │ │ │ waiting on. │ └─────────────────┐ │ ┌────┴────┐ ┌─▼──┴────┐ Task A waits on resource 2. │ Resource│ │ Resource│ │ 1 │ │ 2 │ └─────────┘ └─────────┘ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- Task B requests resource 1. ┌─────────┐ ┌─────────┐ │ │ │ │ A lock wait is created to │ Task A │ │ Task B │ indicate that task B └─▲─────┬─┘ └─▲─────┬─┘ is waiting on resource 1. │ │ │ │ │ │ │ │ Task B waits. ┌────────┴┐ ┌─▼───────┐ ┌───────┴─┐ ┌─▼───────┐ │ Lock │ │Lock wait│ │ Lock │ │Lock wait│ When the deadlock detector │ A-1 │ │ A-2 │ │ B-2 │ │ B-1 │ is activated, it finds └────▲────┘ └────┬────┘ └────▲────┘ └────┬────┘ both task A and task B │ │ │ │ waiting on resource 2 │ │ │ │ and may then check for ┌────┴────┐ ┌────▼────┐ │ │ deadlocks. │ Resource│ │ Resource│ │ │ │ 1 │ │ 2 ├─────────┘ │ The lock wait-to-resource └────▲────┘ └─────────┘ │ chain shows the resource │ │ that the task is waiting on. └───────────────────────────────────────┘ The resource-to-lock-to task chain shows which tasks own a given resource. Using this information, the deadlock detector can determine tasks that are deadlocked. --------------------------------------------------------------------------------
Deadlock Detection Interval
You can control the frequency with which the deadlock detection mechanism searches for deadlocked tasks using the DEADLOCK DETECTION parameter of the SYSTEM statement.
The DEADLOCK DETECTION parameter allows you to specify the amount of time that elapses before the deadlock detection mechanism searches for deadlocked tasks.
You can use the DCMT VARY DEADLOCK command at runtime to override the system generation specification.
More Information:
|
Copyright © 2014 CA.
All rights reserved.
|
|