First, I would like to thank all the members here who don't get annoyed when someone asks a very general or basic question. I really appreciate that about this community, because I don't find this kind of attitude everywhere.
Now coming to my actual question. When we write C code for a microcontroller, we normally have a main() function with a superloop inside it, where different things are handled one after another. So, I was thinking that I could consider this as one task that the CPU keeps executing.
Then we move to OS-style programming, where we can have multiple tasks and a scheduler decides which task should run and when, like in Linux. So my understanding is that multiple tasks are somewhat like having multiple loops, with each loop handling a different task.
So should I think about the application in terms of dependent and independent activities? For example, I have read in some places that when we have independent things that need to be done, it can make sense to create separate tasks for them. On the other hand, if some activities depend heavily on each other, they may be better handled within the same task.
I have also seen some places that when one main loop starts doing many different things and becomes difficult to manage, we can separate those activities into different tasks to make the application easier to organize and maintain.
So is this a reasonable way to think about why we create multiple tasks? Or are there other important reasons or criteria for deciding when something should become a separate task?
Now coming to my actual question. When we write C code for a microcontroller, we normally have a main() function with a superloop inside it, where different things are handled one after another. So, I was thinking that I could consider this as one task that the CPU keeps executing.
Then we move to OS-style programming, where we can have multiple tasks and a scheduler decides which task should run and when, like in Linux. So my understanding is that multiple tasks are somewhat like having multiple loops, with each loop handling a different task.
So should I think about the application in terms of dependent and independent activities? For example, I have read in some places that when we have independent things that need to be done, it can make sense to create separate tasks for them. On the other hand, if some activities depend heavily on each other, they may be better handled within the same task.
I have also seen some places that when one main loop starts doing many different things and becomes difficult to manage, we can separate those activities into different tasks to make the application easier to organize and maintain.
So is this a reasonable way to think about why we create multiple tasks? Or are there other important reasons or criteria for deciding when something should become a separate task?