← Revolut Interview Insights

Revolut·Backend Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Revolut backend interview that went straight into concurrency territory. The transfer function problem sounds deceptively simple but they really want to see if you've thought through what happens when two threads hit the same accounts at the same time.

Questions Asked (1)

Q1

Implement a transfer(from, to, amount) function that moves funds between two accounts in a multithreaded environment. How do you ensure correctness without introducing deadlocks?

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

The naive version with two locks feels obvious until you realize thread A locks account 1 then waits for account 2 while thread B does the exact opposite.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a locking strategy that prevents deadlocks, such as ordered locking or optimistic concurrency. Discuss trade-offs between different approaches and how to handle failures and ensure atomicity.

Pro tip: Mention that you would use a global lock ordering based on account IDs to prevent deadlocks, and consider using a database transaction with SELECT FOR UPDATE in a consistent order. Also, highlight the importance of idempotency and retry mechanisms in a distributed system.

1. Clarify Requirements

Ask about the environment: is it a single process with multiple threads, or distributed? What are the consistency and isolation requirements? Are there performance constraints?

2. Identify Deadlock Risks

Explain that deadlocks can occur if two threads lock accounts in opposite orders. The classic solution is to impose a total order on locks, e.g., by account ID.

3. Propose a Locking Strategy

Describe how to acquire locks in a consistent order: always lock the account with the smaller ID first, then the larger. Alternatively, use a single global lock or optimistic concurrency with versioning.

4. Ensure Atomicity and Consistency

Discuss using database transactions with appropriate isolation levels, or in-memory locks with atomic operations. Mention the need to handle failures and rollbacks.

5. Discuss Trade-offs and Alternatives

Compare pessimistic vs optimistic locking, and centralized vs distributed locking. Mention scalability and performance implications.

Key Points to Mention

  • Deadlock prevention via lock ordering (e.g., by account ID)
  • Use of database transactions with SELECT FOR UPDATE in a consistent order
  • Optimistic concurrency control with version numbers and retry logic
  • Atomicity and isolation guarantees (ACID)
  • Handling of partial failures and idempotency
  • Performance considerations: lock granularity, contention, and throughput

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.