Mr RB
Well-Known Member
...
Your system is not preemptive. To do that you have to stop the task without it cooperation, and save the program counter and registers. Your tasks are cooperative which is OK.
...
I got that. I also clearly covered that in my post (#3) that it's not worth trying to do TRUE pre-emptive multitasking on a 16F/18F PIC.
Preemptive or cooperative is in the spirit of the difference. Wiki says "In simple terms: Preemptive multitasking involves the use of an interrupt mechanism which suspends the currently executing process and invokes a scheduler to determine which process should execute next." meaning that the control mechanism is external to the task itself where as in cooperative systems the tasks have a much greater ability to determine the multitasking themselves.
In the middle there is a whole world of grey, in the same way that "parallel processing" and "multitasking" exist in the grey area that they are not TRUE parallel at all but executed sequentially. However they can be called "parallel" because they function ENOUGH like parallel that for the term to be acceptable.
So you could say something is "multitasking" even though it is not TRUE mutitasking, and you could say it performs more in a "preemptive" manner (more controlled externally) than in a "cooperative" manner (more controlled by the tasks themselves) without requiring true preemptivity any more than it requires true parallel processing.
If you don't like my definition of something in a grey area being "more preemptive" or "more cooperative" in the nature of it's operation that is fine you are entitled to use the terms you prefer.
...
The task examples you show are rather on the simple side. Some tasks are but many are not. For the longer tasks we need to use state machines. Exectute a bit (state) of each task then yeild.
...
You obviously didn't see the project I did here;
Some BIGPIC6 projects (see Project 3)
which is a larger more involved C project where one of the tasks is performed incrementally so that each bar of a 62-bar bargraph is drawn in "parallel" with the other tasks executing at high speeds. I won't be as rude to say "You should do your research" as you said to me but it does get annoying when people criticise what I have done without actually knowing what I have done.
I stated clearly on my page that I am "not an expert in multithreading" and I also made that quite clear in post #3 in this thread. Nobody has commented on the things I may have done differently to other mutlitasking systems, or provided input on what features may be good to add to multitasking systems or suggestions to imrpove systems for the future. This thread has basically degenerated into "your multitasking demo doesn't gain anything", "multitasking is no good anyway" and "let's pompously argue over exact meanings of multitasking terms".
Feel free to read through everything on my PIC-thread page including my 2 larger baudrate converter projects (where the C source is in ZIP form) and if there is one thing there that can spark someone to a new idea or some tiny thing of value then it is not wasted. If you don't gain anything from it that's fine too, I like to read through other peoples code and systems and many times don't gain anything from it. But a thread full of criticism and waffling semantics is not likely to benefit anybody.
Last edited: