docs: explain optional global-interpreter-lock
Documentation URL
https://micropython.org/
Description
I saw this on the homepage:
multithreading via the "_thread" module, with an optional global-interpreter-lock (still work in progress, only available on selected ports)
My question:
So by default micropython does not have GIL? then does it use native multithreading instead of green thread? E.g on a Linux multicore machine?
And how to do mutex between different native threads?
Code of Conduct
Yes, I agree
ESP32: long hardware SPI transfers unnecessarily holding up other threads
The ESP32 hardware SPI implementation spends most of its time just waiting for the hardware to indicate that a transfer is complete. When doing a lot of large transfers (as I do), this means the processor spends a lot of time idle.
I tried shoving the write loop onto a thread but discovered that it makes no difference. Digging into my code (since this bit is my fault now) I realised that I'm not releasing the GIL when waiting on transactions. Adding MP_THREAD_GIL_EXIT/MP_THREAD_GIL_ENTER calls around the waits improves my frame rate by an extraordinary 3x, since my code can now get on with other stuff while the SPI transfers are done.