Week 8 · Wed Sep 16, 2026 · Sep 14-20, 2026

Day 3: Job Scheduler CORE HLD

A scheduler HLD that separates job definitions, schedules, execution instances, leases, attempts, and user-visible status.

What is durable state: the job definition, the scheduled occurrence, or the execution attempt?Frontier · leases · retries · dedupe · recovery3 Heap/Priority Queue slots

Exact Time Blocks

Follow the Week 4 delivery pattern: blank-page first, source reading second, DDIA decision third, spoken close, contiguous algorithm practice, evening recall.

TimeBlockRequired output
08:30Wake + setupOpen this page, start the board, write the day question: What is durable state: the job definition, the scheduled occurrence, or the execution attempt?
08:50—09:00Board setList entities, queues, leases, retry states, dedupe keys, metrics before reading.
09:00—10:05Blank-page attempt + Hello readingBlank-page the scheduler: create job, update recurring schedule, store next fire time, scan due buckets, enqueue executable work, run worker, write attempt/status, expose monitor API. Then read Hello through HLD and update entity names.
10:05—10:45Deep dive + DDIA decisionName the state transitions: scheduled -> due -> leased -> running -> succeeded/failed/retry/dead. Store idempotency key, lease token, attempt number, not_before, and poison reason. User status reads should not depend on worker memory.
10:45—10:55Spoken closeExplain why recurring schedules create execution instances instead of mutating one long-running job row.
14:30—16:15NeetCode Heap/Priority QueueComplete contiguous slots W8-H07—W8-H09; capture invariant and bug risk for each.
20:30—21:15Recall / Q&A / mockUse Staff Q&A, lecture assets, or mock script for the day's system.

Canonical Heading Anchors

Read only the listed Hello Interview headings for today's assignment. Every link is a direct day-page anchor.

  • CORE scope and requirements gate
  • CORE schedule, monitor, cancel contract
  • CORE precision, scale, durability constraints
  • CORE setup and interviewer framing
  • CORE planning spine
  • Job, schedule, execution, attempt, lease
The APIDay 3
  • CORE API
  • CORE write, schedule, dispatch, execute, observe flow
  • CORE architecture

Decision Notes

  • CORE means you must answer requirement, HLD, deep dive, failure, recovery, metric, and Staff-level tradeoff.
  • TRANSFER means blind attempt first, then delta against source, invalid assumption, new bottleneck, and follow-up pressure question.
  • Do not add open-ended AI radar unless it changes a concrete Week 8 design decision; this week it does not.

DDIA Decision Map

Use exact sections only from Ch5, Ch9, and Ch12.

ChapterExact DDIA decision sectionConcrete Week 8 use
Ch5持久化执行与工作流The workflow definition is separate from each execution instance.
Ch5消息代理The dispatch layer decouples time discovery from worker execution.
Ch12消息传递系统Execution messages must support acknowledgement and redelivery semantics.

Heap/Priority Queue Slots

Three contiguous slots today. Keep one invariant and one failure mode per problem.

SlotProblemPatternInvariant / bug riskTime · Space
W8-H07 Find Median From Data Stream two heaps All left items <= all right items, and sizes differ by at most one. O(log n) · O(n)
W8-H08 Merge K Sorted Lists heap of list heads Only the next head of each list belongs in the frontier. O(n log k) · O(k)
W8-H09 Design Twitter heap merge of recency streams News feed is a bounded k-way merge over followed users. O(f log f) · O(f)

Evidence To Save

One compact artifact is enough if it proves mechanism depth.

Invariant

State safety

Name the state that survives restart and the write that makes retry safe.

Failure

Concrete break

Use a worker crash, zombie lease, redelivery, poison message, stale robots decision, or duplicate price event.

Metric

Operational proof

Attach lag, retry rate, duplicate suppression, stale lease reject count, host politeness violation, or alert freshness.

Local study materials
Detailed lecture notes, audio, recall scripts, PDFs, Staff Q&A, and mock packs are archived locally and are intentionally not published on this site.