Overview

In this lecture, the focus is on the challenges and pitfalls that arise in the development of concurrent programs. We begin by questioning what types of concurrency bugs are prevalent in complex applications, referencing a study by Lu et al., which examines major open-source applications like MySQL, Apache, Mozilla, and OpenOffice. This analysis reveals a predominance of non-deadlock bugs, specifically atomicity and order violations, constituting 97% of the concurrency issues identified. Atomicity violation bugs, demonstrated through a MySQL example, occur when operations that are meant to be executed atomically are interrupted, leading to inconsistent program states. Order violation bugs, on the other hand, emerge when the expected sequence of operations is disrupted, often resulting in null-pointer dereferences.

The lecture also covers deadlock issues, a classic problem in concurrent systems where different threads wait indefinitely for resources held by each other, leading to a standstill. Several reasons for deadlocks are discussed, including complex dependencies in large codebases and the nature of encapsulation in software development that complicates locking strategies. The lecture rounds off with strategies for preventing concurrency issues, emphasizing the prevention of circular waits, holding and waiting, no preemption, and mutual exclusion. It proposes practical solutions like lock ordering, acquiring all locks at once, and using atomic operations such as compare-and-swap to minimize the need for locks. These insights underscore the critical nature of understanding and addressing concurrency problems to avoid bugs and ensure the robustness of software applications.

Assigned Reading

Slides

FA 2024 Slides:

https://docs.google.com/presentation/d/17WJkNW_xTXIsVbz5hRvQLU60yDDtbp4zVNEOzaaqMBc/edit?usp=sharing

Original Slides:

https://docs.google.com/presentation/d/1CaQ7QPhuQoRNN1c-DxUI8tZwLJTp25mEK55aupixu6k/edit?usp=sharing

Example Code

Take a look at the associated code for this chapter on GitHub.

References / Resources

No additional references or resources at this time.