JOURNAL

Talking About Deadlocks and Race Conditions

Learn the word 'deadlock' and the vocabulary developers use to talk about race conditions, threads, and concurrency bugs that freeze a program.

Engineers exchanging ideas in a meeting, illustrating workplace English communication.

Read with AI

Choose content to copy and paste into your AI assistant. Nothing is sent automatically. CMS content is converted to Markdown; original Markdown is used when available.

A junior engineer once spent two full days convinced the server had crashed. It hadn’t. Two threads were each holding a lock the other one needed, frozen in a standoff that would never end on its own. The fix took five minutes once she had the word for it: deadlock.

Today’s lesson covers the vocabulary developers use to talk about concurrency bugs — the kind that only show up when two things run at the same time.

Word of the Day: Deadlock

Deadlock /ˈdedˌlɒk/ (noun/verb) — a situation where two or more processes each wait for the other to release a resource, so none of them can ever proceed.

Nghĩa tiếng Việt: tình trạng bế tắc, khóa chéo — khi hai hoặc nhiều tiến trình cùng chờ nhau giải phóng tài nguyên, dẫn đến không tiến trình nào chạy tiếp được.

  • The database hit a deadlock when two transactions tried to update the same two rows in opposite order.
  • We added a timeout so a deadlock would eventually get killed instead of hanging forever.
  • Our monitoring alerted us the moment a deadlock occurred in production.

Dictionary reference: Cambridge Dictionary — deadlock. Hear it in real sentences: YouGlish — deadlock.

Vocabulary Table

TermMeaning (VN)Example
race conditiontình trạng tranh chấp, kết quả phụ thuộc thứ tự chạyWe had a race condition where two requests both read the old balance before either wrote the new one.
threadluồng (xử lý song song trong một chương trình)Each incoming request spawns a new thread to handle it.
lock / mutexkhóa, cơ chế đảm bảo chỉ một luồng truy cập tại một thời điểmWe wrap the shared counter in a mutex so only one thread updates it at a time.
concurrencytính đồng thời, nhiều việc chạy cùng lúcConcurrency bugs are the hardest to reproduce because timing changes every run.
atomic operationthao tác nguyên tử, không thể bị chia cắt giữa chừngIncrementing the counter needs to be an atomic operation, or two threads can overwrite each other.

How a Deadlock Forms

Deadlocks almost always come from the same root cause: two threads grabbing the same two locks in opposite order. Thread A locks resource 1, then waits for resource 2. Thread B already locked resource 2, and is now waiting for resource 1. Neither will ever let go.

Diagram showing Thread A locks resource 1, Thread B locks resource 2, each waiting on the other, resulting in deadlock
Two threads each hold one lock and wait on the other’s lock — neither can proceed, so the program freezes.

Pronunciation Guide

Two syllables, equal stress on both: DEAD-LOCK. The ‘ea’ sounds like the ‘e’ in ‘bed,’ not like ‘deed.’ Say this sentence three times, slightly faster each time:

“The two threads deadlocked because each one locked a resource the other one needed.”

Exercise 1: Fill in the Blank

  1. The app froze because two transactions hit a _____ on the same rows. (deadlock / race condition)
  2. We use a _____ to make sure only one thread touches the shared counter at a time. (mutex / thread)
  3. Incrementing a counter must be _____, or two threads can overwrite each other’s update. (atomic / concurrent)
Show Answers

1. deadlock   2. mutex   3. atomic

Exercise 2: Translate to English

  1. Hai luồng xử lý bị bế tắc vì mỗi luồng đang giữ một khóa mà luồng kia cần.
  2. Chúng tôi thêm thời gian chờ tối đa để hệ thống tự thoát khỏi tình trạng bế tắc.
  3. Lỗi tranh chấp dữ liệu này rất khó tái hiện vì nó phụ thuộc vào thời điểm chạy.
Show Answers

1. The two threads deadlocked because each one was holding a lock the other needed.
2. We added a timeout so the system could recover from the deadlock on its own.
3. This race condition is hard to reproduce because it depends on the timing of execution.

Idiom of the Day: Step on Each Other’s Toes

Step on each other’s toes — when two people (or two processes) interfere with each other while trying to do the same thing at the same time. Nghĩa tiếng Việt: giẫm chân nhau, xung đột khi làm việc cùng lúc.

  • Without a proper lock, two threads kept stepping on each other’s toes and corrupting the data.
  • Our two teams were stepping on each other’s toes until we agreed who owned which service.

Recommended Watching

  • Corey Schafer — clear, practical explanations of threading and concurrency in Python.
  • ByteByteGo — visual breakdowns of concurrency and distributed systems concepts.

Daily Challenge

Explain a deadlock to a non-technical friend using a real-world analogy — two cars stuck at a one-lane bridge, each refusing to back up. Say it out loud in English in three sentences, no notes.

Discussion

Comments are reviewed before publication. Your email is kept private.

← Back to allĐọc tiếng Việt