steveb75 wrote on Thursday, November 25, 2010:
Hello All.
(Using PIC32 Starter Kit)
I’m trying to implement a sync/task start mechanism using counting semaphores. The purpose is to
ensure all task Q’s/Semaphores and H/W is configured before any task begins communicating with
another task.
I have 5 tasks, each creating a Q or semaphore and corresponding H/W configuration. Each task calls
semGive on a counting (taskReady) semaphore then immediately blocks on another counting (taskStart)
semaphore.
I have a 6th ‘supervisor’ task that blocks on the taskReady semaphore and loops (semTake) around this
semaphore until all tasks have reported ready. Once all tasks have given the taskReady semaphore, the
‘supervisor’ task then gives the taskStart semaphore 5 times to allow each task to continue.
The problem I’m facing is only the following two tasks that are created after the supervisor task (from within main())
ever start i.e. supervisor is created 1st followed by task A, task B etc…. These tasks, A and B call semGive(taskReady) and the supervisor task unblocks twice (semTake(taskReady). A breakpoint in the third created task (or any of the other tasks) never hits?
My understanding is that each task should start in accordance with the scheduler rules i.e based on the task pri or maybe the task creation order. After the supervisor task is unblocked twice for task A/B’s semGive(taskReady), it becomes blocked again (permantently). I would expect one of the other tasks to run and call its semGive(taskReady)?
Any suggestions/advice would be greatly appreciated.
Regards,
Steve