← Purestorage Interview Insights

Purestorage·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Apr 2026

Summary

Pure Storage system design round, one meaty question about building an in-memory event dispatcher that spiraled into a pretty deep multithreading conversation. The design part felt manageable but the concurrency follow-ups were where things got uncomfortable fast.

Questions Asked (1)

Q1

Design an in-memory event dispatcher that supports subscribing listeners to event types, unsubscribing them, and firing events to invoke all registered listeners for a given type. Then discuss how your design holds up when all three operations can be called concurrently from multiple threads.

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

Started fine with the basic API, subscribe/unsubscribe/fire with a map of event types to listener lists, nothing wild.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (e.g., event types, listener ordering, thread-safety guarantees) and then design a simple single-threaded version using a map from event type to a collection of listeners. Next, discuss how to make it thread-safe by choosing appropriate synchronization primitives (e.g., read-write locks, concurrent collections) and analyzing trade-offs between simplicity and performance. Finally, address concurrency edge cases like listener modification during dispatch and potential deadlocks.

Pro tip: Demonstrate awareness of the copy-on-write pattern for listener lists to allow lock-free reads during dispatch, and mention that Pure Storage values practical, scalable solutions—so discuss how your design would perform under high read/write ratios.

1. Clarify Requirements and Constraints

Ask about expected event types, listener counts, concurrency levels, ordering guarantees, and whether listeners can be added/removed during dispatch. This shows you think before coding.

2. Design Single-Threaded Core

Propose a basic design: a map from event type to a list of listeners, with methods to subscribe, unsubscribe, and fire. Keep it simple to establish a baseline.

3. Introduce Thread-Safety

Discuss synchronization options: coarse-grained locks, fine-grained locks per event type, or lock-free structures. Explain trade-offs in terms of contention, scalability, and complexity.

4. Handle Concurrency Edge Cases

Address issues like concurrent modification during dispatch (e.g., using copy-on-write or snapshots), reentrant calls, and deadlock avoidance. Mention how to ensure consistency without blocking readers.

5. Analyze Trade-offs and Scalability

Compare your approach to alternatives (e.g., actor model, event loop) and discuss performance under different workloads. Highlight how your design meets Pure Storage's needs for high-performance, concurrent systems.

Key Points to Mention

  • Use of concurrent data structures like ConcurrentHashMap and CopyOnWriteArrayList for thread-safe listener management.
  • Copy-on-write or snapshotting to allow lock-free dispatch and avoid blocking during event firing.
  • Trade-offs between coarse-grained and fine-grained locking, including contention and scalability.
  • Handling of listener exceptions to prevent one listener from affecting others.
  • Potential for deadlocks and reentrancy issues, and how to mitigate them (e.g., avoiding locks during callbacks).
  • Performance considerations for high-frequency events and many listeners, such as batching or asynchronous dispatch.

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