Hi again,

On 09.02.2015 14:33, Kaspar Schleiser wrote:
Hi Joakim,

On 02/09/15 14:20, Joakim Gebart wrote:
Has anyone measured the cost of the thread context switching on the
different platforms? I'm mainly interested in Cortex-M4 (Kinetis). This
would be a good indication of how "slow" an I/O device has to be before
it is worth it to manually yield a thread while waiting.
AFAIR, Hauke measured the context switch cost from msg_send in one thread to msg_receive in another with around 500 instructions on Cortex-M3. A wakeup (one thread running, IRQ triggered saving that context, ISR triggers wakeup of another thread) will probably be a litte less than half of that.
the it was ~550 cycles for sending a message from thread to another, to for msg_send(), context_save, running scheduler, context_restore (of receiving thread), and msg_receive().

Putting a thread to sleep (so switchting to the idle thread) and waking it up again would need 2 context switches -> ~1000 cycles...

Cheers,
Hauke



Consider these figures not very precise. ;)

Kaspar
_______________________________________________
devel mailing list
devel@riot-os.org
http://lists.riot-os.org/mailman/listinfo/devel

_______________________________________________
devel mailing list
devel@riot-os.org
http://lists.riot-os.org/mailman/listinfo/devel

Reply via email to