Arduino Due Task Scheduler

Maybe some consideration should be given to a "Time Triggered" OS
Link here to a free book
http://www.tte-systems.com/books/pttes
Also they have quite a few seminars on YouTube.

Their hybrid system is a co-operative scheduler with just one interrupt.
This system gives a lot of predictability (in terms of time) and by allowing just one interrupt, all the issues relating to pre-emptive multi-tasking are virtually bypassed.

Their system is often used in safety related applications, ie car, planes,

Here is a link to a port to Arduino (well a beginning anyway)

Just my 2c

Kim