Non-Deadlock Bugs
This lesson includes two frequent types of non-deadlock concurrency bugs: atomicity and ordering violation.
We'll cover the following...
Non-deadlock bugs make up a majority of concurrency bugs, according to
- Atomicity violation bugs.
- Order violation bugs.
Atomicity-violation bugs
The first type of problem encountered is referred to as an atomicity violation. Here is a simple example, found in MySQL. Before reading the explanation, try figuring out what the bug is. Do it!
Thread 1::if (thd->proc_info) {fputs(thd->proc_info, ...);}Thread 2::thd->proc_info = NULL;
In the example, two different threads access the field proc_info
in the structure thd
...