Do fibers have priorities?

178 views Asked by At

Fibers are defined as lightweight threads, and threads have priorities because they are preemptively scheduled. However, since fibers are cooperative do they too have priorities?

1

There are 1 answers

0
dnadlinger On

No, they intrinsically don't have priorities, as in cooperative multi-tasking, the context switch target is always determined by the piece of code handing off control (e.g. calling Fiber.yield(), or however it might be called in your implementation).

This doesn't keep you from implementing a scheduler to determine the next switching at the application level, though, which could then decide based on a priority again.