Multiprocessing/ Multithreading.

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
JoePhilip
Posts: 2
Joined: Thu Dec 09, 2021 9:01 am

Multiprocessing/ Multithreading.

Post by JoePhilip » Sat Dec 11, 2021 2:14 pm

Through this forum, I tried searching for materials but I did not come across any links to this.
Is multiprocessing and multithreading supported in python? I have a preference in multiprocessing due to its simplicity and the performance reasons. An example where this finds application is on the robot where every motor or even sensor has its own controlling process and there is only a single main process that does the control and the sending out of the control instructions. I am working on a similar project and trying to control multiple loads: https://www.theengineeringprojects.com/ ... 2-pwm.html I want to use python for this one.
Last edited by JoePhilip on Mon Dec 13, 2021 4:41 am, edited 1 time in total.

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

Preferably neither

Post by pythoncoder » Sat Dec 11, 2021 6:23 pm

MP supports the _thread module which provides threading on most platforms but supports the two cores on the Pico.

However I strongly recommend cooperative multi-tasking using uasyncio for reasons discussed in this tutorial. It's more efficient on a microcontroller (in resources used) and avoids a whole range of highly elusive coding bugs.
Peter Hinch
Index to my micropython libraries.

Post Reply