Setting the Timeslice

Use the following guidelines when setting the timeslice, depending on the priority of the application.

High-Priority Applications

For high priority applications, set the timeslice large enough so that all work can be completed within one timeslice.

The recommended upper bound for timeslice in single, high-priority applications is:

16.6 ms − lptcstcrt = 11.6 ms

Where:

  • lpt is the low-priority timeslice, set to 1.5 ms
  • cst is the context-switch timeout, equal to 2.0 ms
  • crt is the channel reset time, equal to 1.5 ms

For multiple, high-priority applications, use the timeslice for each high-priority application to determine a reasonable bound. The recommended combined workload of all high-priority applications must not exceed 50% of a display refresh cycle.

High-priority applications must avoid flushing work prematurely, whether by calling glFlush or glFinish or by other means. This ensures all rendering for a frame completes without any context switches.

Medium-Priority Applications

For medium-priority applications, set the timeslice both:

  • Large enough that an application can make progress, but
  • Not so large that it affects the scheduling latency of high-priority applications.

The recommended upper bound for timeslice in medium-priority applications is 2 ms.

Low-Priority Applications

For low-priority applications, set the timeslice both:

  • Large enough that an application can make progress, but
  • Not so large that it affects the scheduling latency of high- or medium-priority applications.

The recommended upper bound for timeslice in low-priority applications is 1.5 milliseconds (ms).

Reserve Time for Lower-Priority Applications

To ensure lower-priority applications make reasonable progress, you must ensure that high- and medium-priority applications do not use 100% of the GPU by:

  • Lowering your application frame rate targets and/or
  • Reducing complexity of rendered frames.

The proportion of time to reserve for low-priority applications depends on the number and nature of the applications.