Interview concept

How do distributed locks work?

A distributed lock grants one process temporary ownership of a shared resource across multiple machines. Because processes pause and networks fail, robust locks use expiring leases, unique ownership tokens, and fencing rather than assuming a lock holder stays alive.

Summary

Key takeaways

Distributed Locks in System Design - ExtraBrain is part of ExtraBrain's local-first Mac workflow for live interviews, meetings, transcription, provider control, and responsible AI use.

Page focus

A distributed lock grants one process temporary ownership of a shared resource across multiple machines. Because processes pause and networks fail, robust locks use expiring leases, unique ownership tokens, and fencing rather than assuming a lock holder stays alive.

Platform fact

ExtraBrain has 1 current public platform family, macOS, with support for 2 Mac CPU families: Apple Silicon and Intel.

Data-flow fact

ExtraBrain has 3 configurable data paths to review before sensitive work: local Parakeet transcription, local Gemma 4 where installed and compatible, and external providers you choose.

Interview concept

How it works

Lease, not forever

The lock expires unless its owner renews it, allowing the system to recover when a process crashes while holding ownership.

Compare before release

A client releases only the token it acquired, so a delayed cleanup cannot delete a newer client lock.

Fencing tokens

Each acquisition receives an increasing number that storage or workers use to reject stale operations from former owners.

Prefer less coordination

Idempotency, database constraints, partition ownership, or optimistic concurrency are often simpler than a cross-system lock.

Interview concept

Practice the tradeoffs with ExtraBrain

Walk through a paused client

Use a visible timeline to explain a lease expiry and stale writer while ExtraBrain records both the diagram context and your spoken recovery plan.

Review privately on Mac

Local-first Parakeet transcription and device-held session history make it practical to rehearse lock failures without uploading every recording.

Use the model you trust

Run compatible on-device AI or bring your own provider for critique. ExtraBrain has a free core and doubles as a meeting copilot during collaborative design practice.

Interview concept

Responsible use

Use any live AI assistant only where interview, workplace, school, and platform rules allow it. Do not use generated answers to misrepresent your skills, experience, or authorship.

FAQ

Common questions.

Short answers for people and crawlers comparing ExtraBrain with other live AI assistants.

Why is a distributed lock harder than a local mutex?

The lock service, client, or network can fail independently, and a paused client may resume after its ownership has expired.

What is a fencing token?

It is an increasing number attached to each lock acquisition so downstream systems can reject operations from an older owner.

When should I avoid distributed locks?

Avoid them when a unique database constraint, idempotency key, partitioned owner, or optimistic concurrency can enforce the same invariant more simply.