Hi
I read that different tasks share resources in real time application. I don't understand exactly what resource are and how they are shared ? Is MCU peripheral called a resource?
Hi
I read that different tasks share resources in real time application. I don't understand exactly what resource are and how they are shared ? Is MCU peripheral called a resource?
Anything that is shared between two or more tasks could be considered a resource. One example is a counter that is incremented in an interrupt service routine and tested in some non-interrupt function. Under some conditions, you need to prevent an interrupt while manipulating the variable in the non-interrupt function.
A queue is another example. Data may be put into the queue during an interrupt process and extracted during a non-interrupt process. Or, data could be put into the queue by the non-interrupt function and extracted and sent to the UART by an interrupt function. The head and tail pointers require special handling so that the addresses don't get tangled up.
Hardware resources (peripherals) aren't necessarily shared resources. Usually only one function deals with a peripheral.
Memory can be a shared resource. Perhaps as a result of some DMA function...
The most obvious one is the cpu/mpu itself is a resource. The RTOS time manages execution of multiple tasks.
Well, that's one of those catch-all terms.
A resource used by a task is just anything a task can use while running. A shared resource, you guessed it, is this anything that several tasks could be using instead of just one.
Examples are many. Memory, peripherals, CPU core...
Now before caring about how 'resources' are shared, you may want to start with knowing what tasks are, in what context...
Hardware resources (peripherals) aren't necessarily shared resources. Usually only one function deals with a peripheral.
One can easily share an I2C or Ethernet Interface/peripheral.Or a "pool" of timers.