FreeRTOS Lecture 23 – Scheduling of Tasks

 

Scheduling of Tasks 

 

 

Let’s say you have created two tasks, Task 1 and Task 2 (Figure 1), both assigned equal priorities (Priority 4).

When you schedule the task, how will it be scheduled?

Since both the tasks have the same priorities, i.e., 4, these two tasks will be executed alternatively.

When you schedule these tasks, FreeRTOS will execute them alternately.

  • Task 1 will run for some time slice, and then Task 2 will run for the next time slice.
  • This alternation continues as long as both tasks remain eligible for execution.
  • After the initial time slice, the scheduler will preempt the currently running task (Task 1) to allow the other task (Task 2) to run.
  • This preemption ensures that both tasks get an equal opportunity to execute.
Scheduling of Tasks - Task scheduler
Figure 1. Example of scheduling two tasks with equal priorities.
  • The equal priority setting signifies that the scheduler gives equal importance to both tasks.
  • It ensures fairness in task execution when multiple tasks with the same priority are competing for CPU time.

 

FastBit Embedded Brain Academy Courses

click here: https://fastbitlab.com/course1

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.