TOPIC
Concurrency
These are the same questions found in the library, grouped here by the capability each one mainly examines.
26 questions
A · Professional problem solving and implementation25
- Implement a retry wrapper that retries by error type, supports a maximum attempt count, backoff, and cancellation, and does not overwhelm the dependency. Define the interface before coding, then explain how to make clocks, waits, and tests deterministic.
- Two jobs run fine alone but occasionally hang when run together. What conditions must hold for a deadlock, and how would you confirm that is the cause?
- Your service handles requests with threads and a colleague proposes processes instead. What would you compare, and when would you push back?
- When two transactions modify the same data at once, what anomalies can occur? What does each isolation level prevent, and what does it cost?
- After an async task starts, the caller immediately mutates an input object, and results sometimes change. How would you determine whether this is shared mutable state, copy semantics, or an ownership issue?
- How should coupons, discounts, and flash sales integrate with a trading system without slowing the core transaction flow? How would you calculate, combine, and reconcile discounts?
- Two threads use a flag to signal that data is ready. Why might declaring only the flag atomic still fail to guarantee visibility of the data?
- Consumers are slower than producers, so the message queue keeps growing while upstream requests still succeed. Where would you apply backpressure, and how would you protect recovery capacity?
- In a multicore program, two threads update different fields yet performance falls as core count rises. Explain how cache-line sharing could cause this and how you would verify it in code.
- A list screen scrolls poorly even though network metrics are normal and memory is stable. How would you determine whether main-thread computation, layout/drawing, or lock waits are responsible?
- Implement a map with concurrent reads and writes, per-entry expiration, and expired-entry cleanup. How would you define expiration semantics, synchronization boundaries, and deterministic tests?
- Implement a small task queue with concurrent workers, cancellation, and retries; tests must not depend on real sleeps. How would you design the scheduling interface and state transitions?
- Implement an incremental UTF-8 log parser that receives chunks which may split multibyte characters, reorder fields, contain multiple records, or include an exceptionally long line. Define parser state, error recovery, and memory limits, then implement repeatable core logic.
- Design a service that lets several product teams submit tasks to run after a specified time; tasks may be canceled, rescheduled, or submitted more than once. How would you divide the data model and execution components?
- A critical end-to-end test fails intermittently: it passes alone but fails in a parallel suite, and the team has started rerunning it until it passes. How would you determine whether it exposes product risk, isolate shared state, resource contention, clock or ordering dependencies, and improve the test workflow?
- A request starts several async tasks. After the client disconnects or the request times out, some downstream work still uses threads and connections. How would you propagate cancellation and release those resources?
- A collaborative tool shows who is online and where they are editing. Brief delay is acceptable, but disconnected members must not remain online indefinitely. How would you design updates and expiry?
- A service’s resident memory is stable, but major page faults, disk I/O, and tail latency rise together. How would you distinguish changes in the working set, mapping behavior, memory pressure, and application access patterns?
- After deployment on a multi-socket machine, threads move across NUMA nodes and memory latency varies. How would you investigate using CPU affinity, memory placement, and scheduling behavior?
- After certificate rotation, short connections work, but some clients fail a handshake when reconnecting or resuming after a long-lived connection closes. How would you distinguish certificate-chain, resumption, connection-pool, and client-cache effects?
- When a mobile device switches from Wi-Fi to cellular, some HTTP/3 requests fail while the session still appears online. How would you investigate path migration, timeouts, and middlebox behavior?
- A program writes a data file before updating its index, but after a power loss the index points to incomplete content. How would you analyze write ordering, flush semantics, and recovery?
- Two requests almost simultaneously check that a business object is absent and then both create it; the application-level check-then-write occasionally produces duplicates. How would you use transaction isolation, unique constraints, and conflict handling to preserve the invariant?
- A function appears read-only under multithreading, but a formatter it calls uses a shared internal buffer and occasionally mixes results. How would you distinguish thread safety, reentrancy, and statelessness, and decide where to fix the issue?
- A shared cache is read-heavy and the team plans to replace a mutex with a reader-writer lock. What evidence would you gather, and how would you judge whether the added complexity is worthwhile?
No questions in this section match your target. ·
B · Business understanding and domain modeling1
No questions in this section match your target. ·