This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Multithread with 8051

Hi there,

Does anyone know if it's possible to rum multiple threads on 8051 mocrocontroller?

Thank you.

Parents Reply Children
  • cooperative multi-threading

    Yes, it's the preemption that's the problem, and that largely because of the secondary effects of the way the stack is (and should be) handled for efficiency's sake.

    See, for example, the Salvo RTOS from Pumpkin.

    http://www.pumpkininc.com/

    Take a close look at the restrictions those OS-looking macros, and you'll see that they're really just calling void (void) functions from the top level -- the workloop, as Erik puts it, but without having to hand-code it all. This allows the compiler to build a call tree and overlay memory usage as usual.

    If you want something preemptive, there's CMX RTX, Keil's RTX, uCOS-II, and others.

  • cooperative multi-threading aka the workloop

    Next, the saucer will be called an "cup spill damage preventer"

    Erik

  • cooperative multi-threading
    is that not just the workloop?


    No, its not just an executive loop. Its an OS that provides functions for relinquishing control back to a task management subsystem, where each "thread"s complete context is saved upon doing so. The functions are effectively $REGUSE fn () ... thus allowing the compiler full optimization across the call.

    Its cooperative in that there is no background preemtion mechanism that switches threads, rather each thread must relinquish control back to the OS on its own accord.

    It avoids all the resource consumption involved with true preemption, but still allows you to write linear threads.