Page 2 of 2

Re: uasyncio scheduling algorithm

Posted: Sun May 21, 2017 11:13 am
by pythoncoder
This now works where uasyncio is implemented as frozen bytecode (V1.9 on ESP8266). It now adapts the behaviour of uasyncio by means of a separate module; this avoids the need for modifying the official library. There are minor API changes so any programs employed from the repo should be updated.

I've also included a brief note in the tutorial indicating how such changes can be achieved: the ingenious code from @pfalcon which facilitates this wasn't immediately apparent - to me, at least ;).

Re: uasyncio scheduling algorithm

Posted: Sun May 02, 2021 10:03 am
by mathieu
I'm wondering if significant changes have happened re: this issue over the past 4 years. My use case is that I have time-critical (pushing data to an I2S amp) and non-time-critical (monitoring gyroscope readings and various switches) coroutines, and I'd like to prioritize the former.

What happens when two coroutines are "late" (is "timed out" the right word?) ? is there a way to ensure that one of them always executes first when there is such a conflict?

Re: uasyncio scheduling algorithm

Posted: Sun May 02, 2021 12:21 pm
by pythoncoder
There is currently no way to assign a priority to a task. There has been much discussion about providing a means to assign a high priority to individual I/O based tasks. As I understand it this is a work-in-progress on the part of @Damien, as part of a broader re-think of the select.poll mechanism (uasyncio uses this mechanism to check the status of the ioctl).

My hack to uasyncio which enables I/O to be prioritsed still exists on GitHub but it's based on uasyncio V2 which has serious bugs. Only to be used in extremis.