Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor edits; reviewed

Mutexes are used to prevent multiple threads from accessing critical accessing shared resources at the same time. Sometimes, when locking mutexes, multiple threads hold each other's lock, and the program consequently deadlocks. Four conditions are required for deadlock to occur:

...

This noncompliant code example has behavior that depends on the runtime environment and the platform's scheduler. However, with proper timing, the main() function will deadlock when running thr1 and thr2.  Thread thr1 tries to lock ba2's mutex, while thr2 tries to lock ba1's mutex in the deposit() function, and the program will hang.

...

Deadlock prevents multiple threads from progressing; halting program execution. A denial-of-service attack is possible because the attacker can force deadlock situations. Deadlock is likely to occur in multithreaded programs that manage multiple shared resources.

RecommendationRule

Severity

Likelihood

Remediation Cost

Priority

Level

CON35-C

Low

Probable

Medium

P4

L3

...