Tick-Based CPU Core Temperature Simulator With a Cooling Cascade and Thermal Shutdown

Quick Overview

An online-assessment simulation of CPU core temperatures driven by tick and set-load calls, with deferred loads, a closed-form temperature update, an active-cooling cascade with a vibration penalty, and thermal shutdown and restart thresholds. It tests careful spec reading, exact step ordering and change-only output.

Tick-Based CPU Core Temperature Simulator With a Cooling Cascade and Thermal Shutdown

Company: Optiver

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Online Assessment

An online assessment asks you to implement a simulation of CPU core temperatures from a long written specification; most of the time goes into reading the spec. The simulator exposes at least two operations: - `tick(t)` advances the simulation time. - `set_core_load(...)` sets a core's load. The change does not take effect immediately: it is applied at the next tick, and if a core's load is set several times before that tick, the last write wins. Every tick processes the interval since the previous tick in this order: 1. Advance every core's temperature over the interval, using the state that held during that interval. The temperature law has a closed form, so compute the result directly instead of simulating second by second. 2. Apply the pending loads. 3. Run the active-cooling cascade. The more cores have active cooling enabled, the larger the vibration penalty. 4. Process shutdowns and restarts: a core above 80°C shuts down, and a shut-down core can restart only once it is below 50°C. A shut-down core still cools passively. Each core is always in one of three states: `idle`, `cooling` or `shutdown`. After a tick, output one string of the form `coreA=cooling` for each core whose state changed, sorted by core id; cores whose state did not change are left out. The report does not reproduce the spec's formulas, constants or exact cascade rule. Treat them as inputs you would read from the spec, and use the provided sample, traced tick by tick, to settle anything the text leaves ambiguous. ### Clarifying Questions - Is `t` an absolute timestamp or a duration, and can two ticks have the same time? - What is the temperature law over an interval: an exponential approach toward a load-dependent equilibrium, a linear rate with a floor, or something else? What are the constants? - Which cores take part in the cooling cascade, what exactly does the vibration penalty change, and does the cascade repeat until no core changes? - Are the thresholds strict: does a core at exactly 80°C shut down, and does one at exactly 50°C restart? - Does a shut-down core keep its load, and does a load set while it is shut down apply when it restarts? - When is a running core `idle` rather than `cooling`, and does the initial state count as a change at the first tick? - What does one tick return when no core changes: an empty list, or nothing at all? ### Part 1 — State and the tick pipeline Design the data the simulator keeps between calls, implement `set_core_load`, and implement `tick` as the four steps above in exactly that order, followed by the output. ```hint Two snapshots Separate what was true during the interval that just ended from what will be true during the next one, and ask which of the two each of the four steps reads. ``` #### What This Part Should Cover - Per-core state: temperature, current load, pending load, cooling flag, shutdown flag, last reported state - Deferred loads with last-write-wins, applied only at the next tick - The exact step order, with each step reading the correct snapshot ### Part 2 — Closed-form temperature update Implement step 1 so that a long interval costs the same as a short one: compute each core's temperature at the end of the interval directly from its temperature at the start and the conditions that held during the interval, including passive cooling for shut-down cores. ```hint What stays fixed Ask what does not change between two ticks, and what that makes the temperature's behavior over the interval. ``` #### What This Part Should Cover - Applying the spec's law in closed form under conditions that are constant over the interval - Shut-down cores cooling passively, as the spec requires - Zero-length intervals and floating-point care ### Part 3 — Cooling cascade, shutdown and restart, output Implement step 3, step 4 and the output: run the active-cooling cascade with its vibration penalty, apply the 80°C shutdown and 50°C restart rules, and report the cores whose state changed, sorted by core id. ```hint When the cascade is finished Think about why enabling cooling on one core can change whether another core needs it, and how you know the cascade has settled. ``` #### What This Part Should Cover - A cascade whose decisions interact through the penalty, evaluated to a stable and deterministic result - The gap between the shutdown and restart thresholds, and which cores each rule applies to - Change detection against the last reported state, sorting by core id, and checking the sample tick by tick ### What a Strong Answer Covers - Reading the whole spec and the sample before coding, and keeping a list of ambiguities that the sample resolves - The exact order of steps inside a tick, with deferred loads and last-write-wins - Closed-form temperature updates instead of per-second loops - A cascade that terminates with a deterministic result, and correct shutdown and restart behavior - Output only for changed cores, sorted by core id, with tests that replay the sample tick by tick ### Follow-up Questions - If ticks can be millions of seconds apart, how do you check that your closed form matches a step-by-step simulation? - How would you handle a core crossing 80°C partway through an interval rather than at its end? - With thousands of cores, which parts of a tick grow faster than linearly, and how would you fix them? - How would you make the cascade's result independent of the order in which cores are examined?

Overview: An online-assessment simulation of CPU core temperatures driven by tick and set-load calls, with deferred loads, a closed-form temperature update, an active-cooling cascade with a vibration penalty, and thermal shutdown and restart thresholds. It tests careful spec reading, exact step ordering and change-only output.

Read the full Optiver Software Engineer interview experience this question came from

Optiver logo
Optiver
Nov 2, 2026
mediumSoftware EngineerOnline AssessmentSoftware Engineering Fundamentals
1
0

An online assessment asks you to implement a simulation of CPU core temperatures from a long written specification; most of the time goes into reading the spec. The simulator exposes at least two operations:

  • tick(t) advances the simulation time.
  • set_core_load(...) sets a core's load. The change does not take effect immediately: it is applied at the next tick, and if a core's load is set several times before that tick, the last write wins.

Every tick processes the interval since the previous tick in this order:

  1. Advance every core's temperature over the interval, using the state that held during that interval. The temperature law has a closed form, so compute the result directly instead of simulating second by second.
  2. Apply the pending loads.
  3. Run the active-cooling cascade. The more cores have active cooling enabled, the larger the vibration penalty.
  4. Process shutdowns and restarts: a core above 80°C shuts down, and a shut-down core can restart only once it is below 50°C. A shut-down core still cools passively.

Each core is always in one of three states: idle, cooling or shutdown. After a tick, output one string of the form coreA=cooling for each core whose state changed, sorted by core id; cores whose state did not change are left out.

The report does not reproduce the spec's formulas, constants or exact cascade rule. Treat them as inputs you would read from the spec, and use the provided sample, traced tick by tick, to settle anything the text leaves ambiguous.

Clarifying Questions Guidance

  • Is t an absolute timestamp or a duration, and can two ticks have the same time?
  • What is the temperature law over an interval: an exponential approach toward a load-dependent equilibrium, a linear rate with a floor, or something else? What are the constants?
  • Which cores take part in the cooling cascade, what exactly does the vibration penalty change, and does the cascade repeat until no core changes?
  • Are the thresholds strict: does a core at exactly 80°C shut down, and does one at exactly 50°C restart?
  • Does a shut-down core keep its load, and does a load set while it is shut down apply when it restarts?
  • When is a running core idle rather than cooling , and does the initial state count as a change at the first tick?
  • What does one tick return when no core changes: an empty list, or nothing at all?

Part 1 — State and the tick pipeline

Design the data the simulator keeps between calls, implement set_core_load, and implement tick as the four steps above in exactly that order, followed by the output.

What This Part Should Cover Guidance

  • Per-core state: temperature, current load, pending load, cooling flag, shutdown flag, last reported state
  • Deferred loads with last-write-wins, applied only at the next tick
  • The exact step order, with each step reading the correct snapshot

Part 2 — Closed-form temperature update

Implement step 1 so that a long interval costs the same as a short one: compute each core's temperature at the end of the interval directly from its temperature at the start and the conditions that held during the interval, including passive cooling for shut-down cores.

What This Part Should Cover Guidance

  • Applying the spec's law in closed form under conditions that are constant over the interval
  • Shut-down cores cooling passively, as the spec requires
  • Zero-length intervals and floating-point care

Part 3 — Cooling cascade, shutdown and restart, output

Implement step 3, step 4 and the output: run the active-cooling cascade with its vibration penalty, apply the 80°C shutdown and 50°C restart rules, and report the cores whose state changed, sorted by core id.

What This Part Should Cover Guidance

  • A cascade whose decisions interact through the penalty, evaluated to a stable and deterministic result
  • The gap between the shutdown and restart thresholds, and which cores each rule applies to
  • Change detection against the last reported state, sorting by core id, and checking the sample tick by tick

What a Strong Answer Covers Guidance

  • Reading the whole spec and the sample before coding, and keeping a list of ambiguities that the sample resolves
  • The exact order of steps inside a tick, with deferred loads and last-write-wins
  • Closed-form temperature updates instead of per-second loops
  • A cascade that terminates with a deterministic result, and correct shutdown and restart behavior
  • Output only for changed cores, sorted by core id, with tests that replay the sample tick by tick

Follow-up Questions Guidance

  • If ticks can be millions of seconds apart, how do you check that your closed form matches a step-by-step simulation?
  • How would you handle a core crossing 80°C partway through an interval rather than at its end?
  • With thousands of cores, which parts of a tick grow faster than linearly, and how would you fix them?
  • How would you make the cascade's result independent of the order in which cores are examined?