What is the Double-Checked Locking Pattern?

Updated Apr 28, 2026

Short answer

A concurrency design pattern used to reduce the overhead of acquiring a lock by testing the locking criterion before acquiring the lock.

Deep explanation

It is primarily used to safely implement lazy initialization in multi-threaded environments (like a Thread-Safe Singleton). The first check avoids the expensive lock operation if the instance already exists. If not, the lock is acquired, and a second check is performed because another thread might have initialized it while waiting for the lock. The variable MUST be declared volatile to prevent CPU instruction reordering.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Design Patterns interview questions

View all →