Sunday 11 December 2016

Task Scheduling



Task Scheduling In Embedded Software


“In this blog we will discuss about how to do task scheduling in Embedded Software. Discuss the method for task scheduling and Implementation of task Scheduling”

 Today’s embedded system product requires real time execution of different function. So the software architecture should be implemented in such a way that all functions should be executed in real time and should response to external world quickly. We can achieve real time execution using Task Scheduling. In task scheduling we divide the whole system in small tasks and define time for each task when it will be execute. All tasks will be executed in the round robin fashion. System operating system will monitor each task set execution time when it would be executed. In this scenario we can’t define the priority of task. Next task will be executed after complete execution of current task. If any process requires priority over this task scheduler function we can port that task on some external interrupt.

Task Scheduler Working

In this task scheduling method we monitor the system timer (which can be generated by running a counter in Timer ISR routine) and execute tasks when tasks execution time occurs. In this single task will be executed completely without interruption of other tasks. Task Scheduler mainly requires three parameters related to each task, first is function related to task, how often task will be executed i.e. called Interval Of task and time  when last time task will executed.  For this we make an array of structure with these three parameters and  use function pointers to call the task. System time will be generated through running a counter in timer ISR.
Figure below show the flow chart of Task scheduler routine:


As shown in flow chart after system peripheral initialization array of Structure will be initialized with pointer to function, task interval and last time executed time default to 0. After this compare the difference of System time and task last executed time with the task interval. If difference is greater than task repetitive interval than executed the task else check for next task time. After execution of task update the task last executed time with System current time.

No comments:

Post a Comment