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 .
uasyncio scheduling algorithm
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: uasyncio scheduling algorithm
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: uasyncio scheduling algorithm
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?
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?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: uasyncio scheduling algorithm
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.
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.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.