Multi tasking or realtime operating systems considerations.

Often a realtime extension is used.

Standard RT extensionfacilities

Is normally services like

  • tasks - based on functino for task body

  • mailbox systems - for TX info or data from one task to another.

  • Often mails are configured for a fixed size before starting RT system up and running

  • Semaphores mutex's

  • Integration facilities for interrupt service routines

  • Preemptive scheduling usefull for RMA based systems

  • Non preemptive scheduling - on its way out - can easily conflict with RT demands

  • Priority inheritance protocols for handling critical regions

Std libraries with RT kernel integration

A realtime operating system or kernel may provide proper crafted drivers which handle all waiting and timeout as passive waiting, adv mailbox systems integrated with interrupt servies routine etc. It can be waiting by a semaphore or other realtime constructs. So not CPU time is wasted.

BUT …

If you are using krnl(by me) or arduino ports of FreeRTOS or other realtime extensions they might just use the drivers til serial, i2c etc provided as a part of the distributions.

And they do use busy waiting because the drivers are written for single program use.

  • krnl(by me) has not rt designed drives - allthoughe examples exist

  • freeRTOS has same problemm in many ports

  • the freeRTOS port for arduino avr do not provide rt designed drivers

So beware and do a proper investigation and do not assume anything.

At least look at serial driver, i2c driver, SPI driver your are going to use.

Take a look here at Arduinos HW serial driver- lot of busy waiting. HardwareSerial.cpp and HardwareSerial.h

Look after

  • Interrupt service routines. Do they facilitate data transfer by kernel service like message queues or pipes.

  • Is there busy waiting for calling program in drivers. Can be in TX as well as RX calls.

  • Preemptive or non-preemptive scheduling. Non preemptive drivers can delay information to the final task destination.

Krnl

http://github.com/jdn-aau/krnl

ESP32

MISSING githus link


ESP32 and freeRTOS and waiting

The ESP32 is a duo kernel CPU. The whole driver system is build around freeRTOS so - as far as I can see - they do handle interrupts, waiting etc in the right way(passive) - by use of freeRTOS calls. So waste of CPU time is minimized.

BTW - Do you know Amazon own freeRTOS. They did buy it for IOT use.

OTHER CPUS

If you have some info regarding these items like (serial) drivers handle busy/passive waiting etc I woul dbe happy to hear about it :-)