If you write your program so it always skips ahead if any task is not ready or not needing attention, rather than using wait loops that stop execution waiting on things, you are already multitasking / multithreading!
Most OSs that support preemptive MT, have an equivalent of Critical Section objects; which can (mostly) completely eleviate the "in the middle of something critical" problem.The problem with preemptive scheduling is that there is a danger that the preempted task is in the middle of something critical when it gets interrupted. And the extreme, this can lead to hard to debug interactions with other tasks including deadlocks and race conditions.
It's not a case "need", but rather one of 'makes life easy'.I have not come across a problem where multitasking is needed for any embedded system.
That is not what I would consider embedded. Do you have an embedded example?Think about the combination of software that you are running right now as you read this. In my case, I have two browsers talking to a combined total of 43 websites. Several of which are constantly re-checking the website for updates -- eg. email. One is paused playing a episode of Doctor Who; another is paused playing a video on the aerodynamics of contra-rotating ducted fans.
.. On a operating systems designed for end-users to be able to add and remove software from different places. No comparison to an MCU program created by a single person.Think about the combination of software that you are running right now as you read this.
Does a smartphone count as an embedded application?Do you have an embedded example?
Definitely not.Does a smartphone count as an embedded application?
It wasn't meant as a direct comparison. Just an example of the virtue of separating the scheduling of tasks, from the code that performs those tasks.No comparison to an MCU program created by a single person.
If each of your embedded systems does something very simple that never changes, you do not need MT.
I guessed not, hence going on to describe the hand held terminals.How is a smartphone embedded. It runs a full operating system and runs any software at any time, exactly what I said wasn't an embedded system.
I did finish with: If each of your embedded systems does something very simple that never changes, you do not need MT.
We have different definitions of "Multitasking and multithreading".Multithreading/multitasking IS needed and used in any serious embedded MCU application
Again, I refer you to my earlier response. Not need, just (IMO) easier, cleaner, more maintainable.it just does not need any additional "operating system"
That's what I am trying to understand, for which I have also given an exampleMultithreading/multitasking IS needed and used in any serious embedded MCU application - but via different approaches; it just does not need any additional "operating system" to do it.
It's typically implemented by a mix of cooperative (in the main tasks, executing as needed) and pre-emptive (interrupt controlled).
That's what I am trying to understand, for which I have also given an example
T1 is running for 2ms every 10ms
T2 is running for 4ms every 20ms
T2 is running for 6 ms every 30ms
If I had to enforce that schedule, I'd have a regular interrupt "clock" at 1KHz (10mS) or a convenient multiple of that frequency, eg. 10KHz or whatever works in the overall program.
Doh.. Yep, I re-wrote a part of it and missed that!Except 1KHz is 1mS
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?