Start United States USA — software Chaos Engineering: Deadlock

Chaos Engineering: Deadlock

191
0
TEILEN

A ‘deadlock’ is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by …
Join the DZone community and get the full member experience. In this series of chaos engineering articles, we have been learning to simulate various performance problems. In this post, let’s discuss how to simulate deadlock. Deadlocks tend to happen in multi-threaded applications. The technical definition of a ‘deadlock’ is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process. Here is a practical example that may help you understand deadlocks. Fig1: Trains starting on the same track. Fig2: Trains experiencing Deadlock. Let’s say there is only one train track and this train track has six parts (part-1, part-2, part-3, part-4, part-5, part-6). Let’s say Train-A starts at part-1 and Train-B starts at Part-6 on the same train track at the same time. Let’s say both trains travel at the same speed. Under this circumstance, Train-A and Train-B will reach a deadlock state when they reach part-3 and part-4 of the train track. When Train-A is in part-3 of the train track, it will be stuck waiting for part-4 of the track, which Train-B holds. On the other hand, when Train-B is in part-4, it will be stuck waiting for part-3, which Train-A holds. Thus, both trains can’t move forward.

Continue reading...