Logo

Coding preview

Process Scheduler Simulation

What this preview is

About this preview

Process Scheduler Simulation is a hard quant coding problem on operating systems in Python, asked at Quant.

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.

Building a preemptive scheduler with aging in Python

This is a hard coding problem that tests your ability to simulate a realistic operating-system scheduler. It combines discrete-event thinking, priority queue management, and careful state tracking — all under tight specification. Firms like DE Shaw care deeply about scheduler behaviour because jitter in thread scheduling directly impacts latency-sensitive trading systems.

The core challenge is managing preemption correctly. You must detect when a newly arrived or aged process has better priority than the currently running one, interrupt it mid-burst, and swap in the new process. At the same time, you need to track when aging occurs (at fixed time boundaries), apply it only to waiting processes, and re-evaluate scheduling immediately after. Edge cases include tie-breaking by arrival time and PID, handling processes that arrive simultaneously, and ensuring that priority never goes below zero.

  • Discrete-event simulation and timeline management
  • Priority-based scheduling with preemption logic
  • State transitions (ready, running, waiting) and process lifecycle
  • Correct application of aging to waiting processes only
  • Tie-breaking rules and deterministic ordering