Select Page

Threads Assignment 5

  • Demonstrate that the scheduler always selects the highest Ready state task to run
    Write an atomPrioritySet(…) API function to change the priority of a task.
  • Create two tasks with different priorities.
    Neither task makes any API function calls that cause it to enter the Blocked state.
    • So both are in either Ready or Running state.
    • So the task with highest priority will always be the task selected by the scheduler to be in Running state
  • Expected Behavior
    1. Task 1 is created with the highest priority to be guaranteed to run first. Task 1 prints out a couple of strings before raising the priority of Task 2 to above its own priority.
    2. Task2 starts to run as it has the highest relative priority.
    3. Task 2 prints out a message before setting its own priority back to below that of Task 1.
    4. Task 1 is once again the highest priority task, so it starts to run and forcing Task 2 back into the Ready state.
  • References

    1. Introduction to atomthreads
    2. atomthreads kernel Reference
    3. atomthreads Documentation