I have read a some pages that have great information about Preemptive multitasking but the problem is that there is no reference example given in links in explanation
I did not get any simple and suitable example so I have created an example for learning purpose
idea is that there is one motor in industrial machine that goes on/off for every 20 milliseconds.
The motor can stop only when there is a fire detected in the room or when the temperature of the room is higher than the set temperature of machine or when the fault has been generated in machine.
Task list & priorities
1)Start motor , wait, stop motor - Priority 1
2) Monitor for fire- Priority 2
3) Monitor for fault- Priority 3
4) Monitor for room temperature range- Priority 4
Repeat all process
1. Is this not the right example for preemptive multitasking, if not, why not?
2. We can write programs in different ways, so what to do if I want to write a program for my example in a pre-emptive multitasking fashion?