Deadlock detection/prevention helper.
More...
#include <deadlock_detector.h>
|
| std::unique_ptr< Impl > | impl_ |
Deadlock detection/prevention helper.
Maintains a wait-for graph for cycle detection and provides Banker's safety check for allocation state validation.
Definition at line 27 of file deadlock_detector.h.
◆ DeadlockDetector() [1/3]
| contur::DeadlockDetector::DeadlockDetector |
( |
| ) |
|
◆ ~DeadlockDetector()
| contur::DeadlockDetector::~DeadlockDetector |
( |
| ) |
|
◆ DeadlockDetector() [2/3]
| contur::DeadlockDetector::DeadlockDetector |
( |
const DeadlockDetector & | | ) |
|
|
delete |
◆ DeadlockDetector() [3/3]
| contur::DeadlockDetector::DeadlockDetector |
( |
DeadlockDetector && | | ) |
|
|
noexcept |
◆ getDeadlockedProcesses()
| std::vector< ProcessId > contur::DeadlockDetector::getDeadlockedProcesses |
( |
| ) |
const |
|
nodiscard |
Returns process IDs involved in deadlock cycles.
◆ hasDeadlock()
| bool contur::DeadlockDetector::hasDeadlock |
( |
| ) |
const |
|
nodiscard |
Returns true if the current wait-for graph has a cycle.
◆ isSafeState()
| bool contur::DeadlockDetector::isSafeState |
( |
const std::vector< ResourceAllocation > & | current, |
|
|
const std::vector< ResourceAllocation > & | maximum, |
|
|
const std::vector< std::uint32_t > & | available ) const |
|
nodiscard |
Banker's algorithm safety check.
current[i].resources[r] is currently allocated count for process i, resource r. maximum[i].resources[r] is maximum demand for process i, resource r. available[r] is currently available count for resource r.
◆ onAcquire()
Records successful acquisition of a resource by a process.
- Parameters
-
| pid | Process that acquired resource. |
| resource | Acquired resource identifier. |
◆ onRelease()
Records release of a resource by a process.
- Parameters
-
| pid | Process that released resource. |
| resource | Released resource identifier. |
◆ onWait()
Records waiting on a resource and updates wait-for graph.
- Parameters
-
| pid | Waiting process. |
| resource | Requested resource identifier. |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ impl_
| std::unique_ptr<Impl> contur::DeadlockDetector::impl_ |
|
private |
The documentation for this class was generated from the following file: