RTOS program to generate Round Bin Multitasking algorithm

In this article let’s learn to assign tasks in round robin fashion.In the following program first it assigns highest priority to task1 and then it creates task2,task3. It continous the execution and waits for event in task1,then suspend task1 and then enters into task2. Next it waits for event in task2,then suspend task2 and then enters task 3. it does the same in task3 function. Then it return main and resumes the task1 function and sets task2. It resumes the task2 function and sets for task3. It repeats the same.

So task1——task2——–task3—–task1—— so on

Algorithm:

1)start
2)Declare task1,task2,task3
3)Call the task1 function
4)Assign highest priority to task1,next prioity to task2,last priority to task3
5)Wait for event in task1 and set for task 2
6)Wait for event in task2 and set for task 3
7)Wait for event in task3 and set for task 1

8)end

 

Code goes here:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Advertisment ad adsense adlogger