PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Software Engineering Fundamentals/Amazon

Implement a Single-Node Priority Pub/Sub

Last updated: May 23, 2026

Quick Overview

This question evaluates understanding of concurrent system design, in-memory publish–subscribe semantics, prioritized delivery ordering, API and data structure selection, and thread-safety within the Software Engineering Fundamentals domain.

  • medium
  • Amazon
  • Software Engineering Fundamentals
  • Software Engineer

Implement a Single-Node Priority Pub/Sub

Company: Amazon

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

Implement a simplified in-memory publish-subscribe system that runs on a single machine. The system should support users subscribing to topics with a priority. ### Requirements 1. A user can subscribe to a topic with an integer priority. 2. A user can unsubscribe from a topic. 3. A publisher can publish a message to a topic. 4. When a message is published, it should be delivered to all current subscribers of that topic in descending priority order. 5. If two subscribers have the same priority, deliver to the one who subscribed earlier first. 6. The implementation should be thread-safe enough to support concurrent subscribe, unsubscribe, and publish calls on a single process. Design the classes, main APIs, data structures, and explain the trade-offs.

Quick Answer: This question evaluates understanding of concurrent system design, in-memory publish–subscribe semantics, prioritized delivery ordering, API and data structure selection, and thread-safety within the Software Engineering Fundamentals domain.

Related Interview Questions

  • Validate AI-Generated Code Safely - Amazon (medium)
  • Fix the Password Reset Workflow - Amazon (medium)
  • Design an In-Memory Pub-Sub Model - Amazon (medium)
  • Choose lock granularity for concurrent storage - Amazon (hard)
  • Build a responsive grid of fixed boxes - Amazon (medium)
Amazon logo
Amazon
Apr 9, 2026, 12:00 AM
Software Engineer
Onsite
Software Engineering Fundamentals
0
0

Implement a simplified in-memory publish-subscribe system that runs on a single machine.

The system should support users subscribing to topics with a priority.

Requirements

  1. A user can subscribe to a topic with an integer priority.
  2. A user can unsubscribe from a topic.
  3. A publisher can publish a message to a topic.
  4. When a message is published, it should be delivered to all current subscribers of that topic in descending priority order.
  5. If two subscribers have the same priority, deliver to the one who subscribed earlier first.
  6. The implementation should be thread-safe enough to support concurrent subscribe, unsubscribe, and publish calls on a single process.

Design the classes, main APIs, data structures, and explain the trade-offs.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Amazon•More Software Engineer•Amazon Software Engineer•Amazon Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.