Vixen
dd8b0a81
csharp
public enum JobPriority

Which of the scheduler's two tiers a job goes in.

Read the guide page for this →

Remarks

Two tiers, because there are two answers to one question: does this have to finish before the frame ends? Frame is everything a frame is made of and it is the default, so a caller that has not thought about it gets the tier that cannot be starved. Background is work that has to finish eventually — an import, a bake, an unwrap, a decode — and would rather be late than make a frame late.

⚠ Deferral, not preemption. A job is a struct's Execute running on a worker thread; there is no safe point to suspend it at and no portable way to suspend a thread mid-call anyway. So a Background job that has started runs to completion, and what the tier buys is only which item a thread picks up next. The consequence is worth stating rather than discovering: one background job that takes a hundred milliseconds delays the frame work behind it by up to a hundred milliseconds on that one thread, whatever tier it is in. Splitting long work into batches is what makes the tier effective, and ScheduleParallel``1 is how.

⚠ The tier is not a correctness device. Dependency edges are unchanged: a Frame job that depends on a Background job waits for it, and no priority makes it wait less. If the answer wanted is "this must not run yet", that is an edge, not a tier.

Fields and properties (2)

  • Frame

    Work the current frame is waiting for. The default, and never deferred.

  • Background

    Work that has to finish eventually, and would rather be late than make a frame late.

Used by (4)

  • GlobalDistanceFieldRendererVixen.Rendering
  • JobPriorityTestsVixen.Core.Threading.Tests
  • JobSchedulerVixen.Core.Threading
  • JobSlotVixen.Core.Threading