uasyncio scheduling algorithm

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: uasyncio scheduling algorithm

Post by pythoncoder » Sun May 21, 2017 11:13 am

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 ;).
Peter Hinch
Index to my micropython libraries.

User avatar
mathieu
Posts: 88
Joined: Fri Nov 10, 2017 9:57 pm

Re: uasyncio scheduling algorithm

Post by mathieu » Sun May 02, 2021 10:03 am

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?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: uasyncio scheduling algorithm

Post by pythoncoder » Sun May 02, 2021 12:21 pm

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.
Peter Hinch
Index to my micropython libraries.

Post Reply