Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Quantitative Finance · Glossaire

Qu'est-ce que « Timer wheel, injected clock » ?

Aussi appelé : timer wheel · injected clock

Definition 20.2 Low-Latency Software · Chapitre 20 — The Strategy Engine

A timer wheel is a circular array of slots, each covering an interval of time (its granularity): a timer is filed in the slot of its expiry time modulo the wheel’s span, and advancing the wheel visits the slots of the time that has passed and fires the timers due in them; scheduling costs a constant time whatever the number of timers. An injected clock is a clock passed to the code that needs the time instead of being read by it: the same code runs on the simulated clock of a recorded day (One Quant Book 7, chapter 17) or on the machine’s real clock.

A hashed timing wheel of 16 slots (the build’s has 1 024 of 100\, µ s). Scheduling puts a timer in the slot of its expiry time; advancing visits the slots passed and fires only the timers due, sorted; a timer further than one revolution stays in its slot until its time comes round.
Figure 20.3. A hashed timing wheel of 16 slots (the build’s has 1 024 of 100 µs100\,\text{µ}\mathrm{s}). Scheduling puts a timer in the slot of its expiry time; advancing visits the slots passed and fires only the timers due, sorted; a timer further than one revolution stays in its slot until its time comes round.
Lire dans le chapitre →