Slide 1 Slide 2 Slide 3 Slide 4 Slide 5 Slide 6 Slide 7 Slide 8 Slide 9 Slide 10 Slide 11 Product List
SYS/BIOS Semaphores Slide 6

Finally, TI is going to give a slightly more complex example. In this case, one has two different tasks that are both blocked because they are pending on the same semaphore. This is OK because multiple tasks can all pend on the same semaphore. Because the higher priority tasks are blocked, it is the lowest priority task that is running, and it in turn makes a call to Semaphore_post. As soon as it does so, this allows one of the tasks, but only one of the tasks to unblock and be made ready to run. The scheduler will simply pick the first task in its queue to unblock first, and as in the previous example, the semaphore value stays at 0. Note here that the first task in the queue is the first to unblock, which means the first task that blocked will be the first one that is made ready to run as soon as the semaphore is posted. In this example, even though one of the blocked tasks has a higher priority than the other, it is not necessarily the one that is made ready to run.

PTM Published on: 2012-07-19