Multi threading in arduino

Hi all Is it possible to do multi threading in the arduino C code like in linux based embedded boards ? If yes how ?


You can use interrupts and implement time sharing. I think there is an RTOS implemented on Arduino.

Perhaps you'd like the 8-core Propeller processor instead.

You could - I think I’ve seen a threading library mentioned in the forums, but if you’re working on a project that really requires it, you should probably consider another platform. Arduino is fast enough that you can usually make it appear that it’s doing several things at once without resorting to multithreading, and even if you did, it’s still single core, so it still isn’t really.

It's technically possible. But I don't think the Arduino has enough processing power or RAM to justify it. By the time your application is complex enough to need multi-threading, with all the complexity and synchronisation issues that implies, it is probably so big that Arduino ceases to be a viable platform for it.

Arduino suits a completely different approach where you do your work asynchronously in a single thread, instead of using multiple threads.

I had the same question, and have a (now surplus) BeagleBoard on the shelf. I decided that for my application I could achieve the necessary capabilities with a cooperative multi-tasking approach (which is far less resource-intensive than either multi-threading or pre-emptive multi-tasking).

I had briefly considered using the BeagleBoard as a main processor, with the Arduino as an I/O processor - but decided that I didn’t want to cope with communication latencies. So far, it appears that I’ll be able to fit everything I need into the Arduino.

I don’t think anyone could give you a meaningful one-size-fits-all response. If the Arduino appears as if it might be an appropriate solution (in terms of I/O and immediacy of control) then I suggest building a test suite on which you can arrive at your own application-specific evaluation.