PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Applied

Implement a single-thread task scheduler API

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of task scheduling, timing semantics, deterministic ordering, single-thread concurrency control, and data structure choices for managing timed and periodic callbacks.

  • medium
  • Applied
  • Coding & Algorithms
  • Software Engineer

Implement a single-thread task scheduler API

Company: Applied

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Design and implement a simple task scheduler for a **single CPU, single thread** environment. You need to support scheduling callbacks (tasks) using the following APIs: - `scheduleOnce(task, runAtTime)` - runs `task` exactly once at the specified absolute time. - `scheduleWithDelay(task, delay)` - runs `task` exactly once after the specified delay from “now”. - `schedulePeriodic(task, initialDelay, period)` - runs `task` first after `initialDelay`, then repeatedly every `period`. ### Requirements - Only one task runs at a time (no parallelism). - If multiple tasks are due at the same time, execute them in a deterministic order (define one). - Define behavior if a periodic task’s next run time is missed because execution took too long. - Include how the scheduler waits/sleeps and wakes up to run the next task. ### Deliverable Describe the data structures and implement the scheduler logic.

Quick Answer: This question evaluates understanding of task scheduling, timing semantics, deterministic ordering, single-thread concurrency control, and data structure choices for managing timed and periodic callbacks.

Related Interview Questions

  • Merge Overlapping Collinear Segments - Applied (hard)
  • Implement a Fixed-Capacity Deque - Applied (medium)
  • Implement Nested Transactional Key-Value Store - Applied (hard)
  • Merge overlapping 2D line segments - Applied (medium)
  • Find intersection of two line segments - Applied (easy)
Applied logo
Applied
Feb 11, 2026, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
2
0
Loading...

Design and implement a simple task scheduler for a single CPU, single thread environment.

You need to support scheduling callbacks (tasks) using the following APIs:

  • scheduleOnce(task, runAtTime)
    • runs task exactly once at the specified absolute time.
  • scheduleWithDelay(task, delay)
    • runs task exactly once after the specified delay from “now”.
  • schedulePeriodic(task, initialDelay, period)
    • runs task first after initialDelay , then repeatedly every period .

Requirements

  • Only one task runs at a time (no parallelism).
  • If multiple tasks are due at the same time, execute them in a deterministic order (define one).
  • Define behavior if a periodic task’s next run time is missed because execution took too long.
  • Include how the scheduler waits/sleeps and wakes up to run the next task.

Deliverable

Describe the data structures and implement the scheduler logic.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Applied•More Software Engineer•Applied Software Engineer•Applied Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ 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.