This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Scheduler benefits

Hi, I'm doing some throughput/current consumption tests with nRF51822 (on PCA10001). My firmware has been developed starting from hrm example. I have created a custom service for sending 20byte with notification (many have already done the same, I know). I would like to ask which are the advantages/disadvantages of using scheduler? I've understand that it moves task execution from interrupt context to main context, but what imply this? Is it faster in execution? More reliable? Thanks Davide.

Parents
  • Hi Davide

    Yes, you are correct, the purpose of using the scheduler is to have your code execute in the main context, which is the lowest priority. The motivation for executing code in the lowest priority is to not let your code execution block other tasks that need to run with minimum latency. When you i.e. get a callback from the softdevice which has ARM priority 3, execution of that callback handler will block other softdevice callbacks. It is therefore a good practice to call the scheduler instead of executing a long task in the callback handler. An introduction how the priorities work is given on these threads (1) (2).

Reply
  • Hi Davide

    Yes, you are correct, the purpose of using the scheduler is to have your code execute in the main context, which is the lowest priority. The motivation for executing code in the lowest priority is to not let your code execution block other tasks that need to run with minimum latency. When you i.e. get a callback from the softdevice which has ARM priority 3, execution of that callback handler will block other softdevice callbacks. It is therefore a good practice to call the scheduler instead of executing a long task in the callback handler. An introduction how the priorities work is given on these threads (1) (2).

Children
Related