cqueues icon indicating copy to clipboard operation
cqueues copied to clipboard

cqueue resume order

Open aleclarson opened this issue 7 years ago • 1 comments

Why are new coroutines inserted at the head of their cqueue? This causes newer coroutines to be resumed first, which seems counter-intuitive, but I must be missing something.

aleclarson avatar Apr 18 '18 17:04 aleclarson

The order is undefined: it is currently LIFO because it:

  1. is the fastest in code (just add to/remove from head of a linked list)
  2. may make use of warm cpu caches by resuming the most recent piece of code

I recall discussion of making the scheduling algorithm pluggable; but nothing lately.

daurnimator avatar Apr 18 '18 22:04 daurnimator