Dirty reads
Many programmers new to these topics make a fatal assumption, and think something like this: Okay, I understand that when modifying a shared resource—like a global data structure — I will be required to treat the code as a critical section and protect it with locking, but, my code is only iterating over a global linked list; it's only reading it and never writing to it and hence, this is not a critical section and does not require protection (I'll even get brownie points for high performance).
Burst the bubble, please! It is a critical section. Why? Visualize this: while your code is iterating over the global linked list (only reading it), precisely because you have not taken a lock or synchronized in some other manner, another ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access