Design a Task Scheduler

Hard · Low-Level Design · about 50 minutes

Asked at Salesforce, Oracle, Databricks, Microsoft, ServiceNow, Confluent, Elastic, Hugging Face, SAP.

Design an in-process task scheduler, like Java's ScheduledExecutorService. Clients schedule a task to run once after a delay, at a fixed rate, or on a cron-like schedule, and can cancel it. A fixed pool of worker threads runs due tasks. Don't busy-poll.

Related guides