开发者

Do fibers have priorities?

Fibers are defined as lightweight threads, and threads have priorities because they are preemptively s开发者_开发技巧cheduled. However, since fibers are cooperative do they too have priorities?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜