Learned a cool trick in Python, if need to have more deterministic latency for a thread: shutdown the gc as prologue and do collection once as epilogue.
I.e.
gc.disable()
# Do stuff that does not cause CPU
# exceptions or interrupts.
gc.collect()
I also noticed that MicroPython has pretty usable inline assembler.
This makes me wonder if you could implement Python version of https://rtic.rs/2/book/en/ running hard real-time tasks on bare metal.
This is more like learning thing than challenging thing… I.e. by doing the similar thing perhaps in limited scope in other language it is easier to get grip of the original target…