Apple interview question
Implement a thread-safe linked list with fine-grained locking
- Company:
- Apple
- Type:
- Coding
- Difficulty:
- Hard
- Reported:
- November 16, 2026
Problem
Implement a thread-safe concurrent linked list that supports insert(), delete() and read() operations called from many threads at once.
The interviewer was looking for: multithreaded concurrency control, fine-grained locking (node-level locks, hand-over-hand locking) rather than one global lock, use of sentinel nodes, and reasoning about lock contention and thread safety under high concurrency.
Example 1
Input: insert(1), insert(3), delete(3), read()
Output: True, [1]
The deleted value no longer appears.
Example 2
Input: four threads each insert 100 different values at the same time, then read()
Output: all 400 values, each exactly once
No concurrent insert may be lost or duplicated.
Constraints
- Not stated; ask the interviewer.
Reported by candidates or drawn from publicly available sources, and rewritten in our own words. Pathwise Prep does not publish confidential assessment content. Report a concern