KatInterview

Design a Desktop OS Notification Framework with AI Collaboration

System DesignModel answer
MediumModel answerSystem Designsystem designoperating systemsdesktop apps

Last updated

Architect a local operating system notification system for desktop apps and use an AI assistant to refine specific low-level logic safely.

Architect a desktop OS-level notification manager that allows native applications to publish, update, and manage alerts shown to the user. This system must handle local and remote inputs, enforce user preferences, and survive system restarts.

During this problem, you are expected to demonstrate how you would collaborate with an AI assistant to design or implement a critical subset of this system (such as the client API, local storage schema, or IPC dispatch logic).


Key Requirements & Constraints

  1. Lifecycle & Control:

    • Applications must be able to publish, modify, and revoke notifications.
    • Notifications have priority levels, expiration times, and potential action buttons.
    • The user must be able to mute specific apps, enable Do-Not-Disturb (DND) modes, and view historical alerts in a persistent action center.
  2. System Architecture:

    • High isolation: Untrusted client applications must not crash the central manager or block other applications.
    • Persistence: Notification state must persist across system reboots until cleared or expired.
    • Resource Constraints: Low memory footprint, responsive UI (sub-50ms latency from dispatch to render), and fair queuing to mitigate spammy applications.
  3. AI Collaboration Exercise:

    • Provide an initial prompt to generate a core component (e.g., the C++ IPC client library interface or the central manager's thread-safe queue dispatch mechanism).
    • Detail your evaluation strategy for the generated output, identifying potential risks (hallucinated APIs, concurrency flaws, deadlocks, missing edge cases).
    • Show how you refine the prompt to produce an enterprise-grade solution.

Expectation

Provide an architectural overview detailing component interaction, security boundaries, and data flow. Then, illustrate your interactive prompting workflow to construct and validate a specific component of the system.

Hints

Hint 1

Consider using Inter-Process Communication (IPC) via Unix Domain Sockets or Named Pipes to decouple untrusted client applications from the core notification daemon.

Hint 2

Ensure application limits are enforced via token-bucket rate limiting inside the central service to prevent a rogue app from exhausting disk space or UI resources.

Hint 3

When evaluating AI responses for low-level system design, explicitly check for thread safety, non-blocking I/O, resource cleanup (RAII), and robust error handling.