Redis (thực tế là) đơn luồng khi thực thi lệnh, nên mỗi lệnh thực thi nguyên tử — hoàn toàn, không có lệnh khác từ client khác xen vào. Tính nguyên tử này, kết hợp với các lệnh phức hợp nguyên tử, là nền tảng để dùng Redis đúng cho counter, lock, và các thao tác nhạy cảm với concurrency.
Đơn luồng → lệnh nguyên tử
Redis executes commands ONE AT A TIME (single-threaded command processing):
→ each command runs to completion before the next starts
→ NO two commands interleave → every command is inherently ATOMIC
→ no race conditions WITHIN a single command
→ This simplicity is a feature: predictable, atomic operations without locks.
