Multithreading/ Multiprocessing & other libraries

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
gaurav1788
Posts: 1
Joined: Tue Oct 04, 2016 2:32 pm

Multithreading/ Multiprocessing & other libraries

Post by gaurav1788 » Tue Oct 04, 2016 2:54 pm

Hello All,

I'm new to the forum. I have two questions:

(1)
I tried going through the earlier posts regarding this, but last relevant post is from Aug, 2014. I want to know that is it possible to implement multithreading/ multiprocessing to micropython. I posts from 2014 it was written that it will take a long time. It's been long time since then, is it now possible?


(2)
There are some other libraries like sklearn and Pybrain I want to import. Is it possible? If yes, how?

Thanks.

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

Re: Multithreading/ Multiprocessing & other libraries

Post by pythoncoder » Tue Oct 04, 2016 4:53 pm

The official method of cooperative multi-tasking is uasyncio. There is support for pre-emptive multi threading in the form of the _thread library but I think this is currently implemented only on the WiPy. uasyncio is the way to proceed for web applications and suchlike where fast response is not mandatory; its timing granularity is currently constrained to one second. Applications requiring faster task switching can use this library https://github.com/peterhinch/Micropython-scheduler.git which implements cooperative multi-threading using Python generators.
Peter Hinch
Index to my micropython libraries.

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Multithreading/ Multiprocessing & other libraries

Post by pfalcon » Wed Oct 05, 2016 9:24 am

Information in the previous message isn't fully correct. Please proceed to the official announcement of multithreading support for complete information on the matter: http://forum.micropython.org/viewtopic.php?f=8&t=1864
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Post Reply