title: How do real-time game engines work on Windows?
body: <p>I come from an embedded background, where hard real-time is taken quite seriously. For me (fast) real time is tricky on Linux, and ludicrous on Windows, jet video games seem to be doing just fine.</p>
  <p>Obviously, since it's only soft real time, and the frequency is (relatively) low with 60+ Hz, the simple solution is to render as fast as possible and hope for the best. But are there any advanced techniques in use that further enhance the responsiveness on Windows?</p>
  <p>Some concrete questions:</p>
  <ol>
  <li>Is there a way to handle Windows pre-empting at unfavourable moments? How do you share work on multiple cores when some of them are doing something else?</li>
  <li>Is IO-latency in Windows deterministic? Can (should) you pressure the scheduler to context switch ASAP?</li>
  <li>How common are scheduling techniques like Earliest Deadline First / Rate Monotonic Scheduling (or others)? (build on top of the existing one of course)</li>
  </ol>
  <p>Any insight would be welcome!</p>
  <p>Edit:</p>
  <p>I've looked through a few resources and have added my conclusions:</p>
  <p>1.
  Q: What happens when a time critical calculation gets pre-empted?</p>
  <pre><code>A: The thread should have higher priority so pre-emption is rare, and when it happens, the interruption should be brief (short interrupts or IO-operations).
  </code></pre>
  <p>Windows has the capability to move threads to other cores, thou it is recommended to keep them locked ( -&gt; Thread Affinity).</p>
  <p>2.
  Q: Should IO-operations have a higher priority than the render loop?</p>
  <pre><code>A: Yes, Naughty Dog's engine gives IO-operation higher priority.
  </code></pre>
  <ol start="3">
  <li>Q: What kind of scheduling is used?</li>
  </ol>
  <pre><code>A: In the presentation, a job system is used (similar to reactive programming).
  </code></pre>
  <p>It uses three priorities that are non-preemptive.</p>