Show answer
Answer
Source: Blind: Confusing experience of Databricks interview, Java Concurrency in Practice
13 operating systems interview questions on thread safe data structures and concurrent rate limiting, each with the correct answer and a full explanation.
Answer
Source: Blind: Confusing experience of Databricks interview, Java Concurrency in Practice
Answer
Source: Java Concurrency in Practice, OSTEP: Locks
Answer
Source: Java Concurrency in Practice, OSTEP: Common Concurrency Problems
Answer
Source: Blind: Confusing experience of Databricks interview, Java Concurrency in Practice
Answer
Source: Java Concurrency in Practice
Answer
Source: Blind: Confusing experience of Databricks interview, Java Concurrency in Practice
Answer
Source: OSTEP: Common Concurrency Problems, Blind: Confusing experience of Databricks interview
Answer
Source: Java Concurrency in Practice, OSTEP: Concurrency: An Introduction
Answer
Baseline: hash map plus doubly linked list under one mutex; get moves to front, put inserts and evicts the tail, both O(1).
Expiry: store an expiry timestamp per entry and treat expired entries as misses on get (lazy), plus a background sweeper or a timer wheel to free memory for entries never read again.
Scaling reads: shard into N independent LRUs by key hash (approximate global LRU, much less contention), or record accesses in a per thread buffer and apply recency updates in batches under the lock.
Pitfalls: read lock for get (get writes), checking expiry outside the lock, and doing loads on miss while holding the lock (use a per key future so only one loader runs).
Source: Blind: Confusing experience of Databricks interview, Java Concurrency in Practice
prune(log, now - 1.0)
if len(log) < 10:
log.append(now)
return True
return FalseAnswer
Source: Anthropic concurrency interview questions, Java Concurrency in Practice
Answer
Answer
Answer
Source: Anthropic concurrency interview questions, Java Concurrency in Practice
These questions come from the Operating Systems Interview Practice pack in Bertopia.