Search⌘ K
AI Features

Practice: Extending a Multithreaded System With an Unfamiliar

Extend a multithreaded system with an unfamiliar library, a practice task in the style of Palantir's FDSE learning round. Read the supplied pool, ticket and snapshot-store contracts, implement a coordinator that submits all work, observes every outcome and publishes a complete catalog only when every load succeeds, and return ordered diagnostics on failure. Verify behavior with event-based scheduling checks rather than sleeps, and separate predictions from executed evidence.

A catalog reader must keep seeing [(‘legacy’, 3)] while three replacement entries are loading. Implement refresh_catalog(requests, load_entry, store, pool) so the entire new catalog appears only after every load succeeds.

  • Ordered requests: [‘atlas’, ‘beacon’, ‘cedar’].

  • Successful values, respectively: (‘atlas’, 12), (‘beacon’, 7), and (‘cedar’, 9).

The scheduler may finish them in any order; the reader must receive the complete catalog in request order.

What must readers see while atlas is loading?

That is the whole-snapshot invariant for this task.

A reported learning-round task family involves learning supplied material, applying it, and extending understanding. Candidate accounts do not establish a guaranteed technology or format. The library, application, and verification scenarios here are course-authored preparation materials, not Palantir technology, a reported interview question, or an official scoring rubric.

This is one implementation task using the concurrency contracts already covered earlier in this chapter. Use an independent Python 3.12 workspace; no earlier exercise files are needed.

Which contracts govern refresh_catalog?

The workspace contains five files:

  • work_pool.py: The complete pool, ticket wrapper, and completion barrier. Treat this library as read-only.

  • catalog_store.py: The complete synchronized snapshot store. Treat it as read-only.

  • catalog_refresh.py: The existing sequential helper and your empty extension stub.

  • test_catalog_refresh.py: Fixtures, deterministic scheduling checks, and empty prediction and evidence fields.

  • catalog_contract.txt: The following indexed documentation packet.

P1: Submission and outcomes

Pool.submit(function, argument) starts work and returns a ticket representing its eventual outcome. Submission does not establish completion. Completion order is unspecified.

wait_all(tickets) waits until every supplied ticket reaches a terminal outcome, including failure. It does not raise worker exceptions or retrieve their results.

ticket.result() waits if necessary, then returns the worker’s value or raises its exception. Waiting for terminal outcomes therefore does not establish that all tasks succeeded. ...