TaskNotification or Event groups

rrrum wrote on Wednesday, July 13, 2016:

Hello,

I would like to ask for a opinion, it is a design issue and I am not able to find among many different mechanisms the right one for my task:

  1. Let’s focus on 3 tasks, A, B1, B2

  2. Task A is implemented as follows: waits on its “command queue” and there is also timeout set to allow it to run periodically to do some work if no commands are present.

  3. Task A is controlling also B1 and B2, at some point task A writes to receive queues of B1 and B2 which unblock and B1 or B2 or both run

  4. Each task B1 and B2 should set some flag, showing task is running

  5. It can take undefined amount of time to complete B1 or B2, when completed, each task resets its “running flag”

  6. Now task A, at some point in the “periodic” run section, should check if tasks B1 and B2 completed their job (running flag not set), if both are finished it should perform some action, otherwise is should just continue executing periodic stuff.

So I wonder if task notification mechanism or event groups can be used for this purpose or what is the most suitable/efficient mechanism for this design problem.

Thank you

rum

hs2sf wrote on Thursday, July 14, 2016:

IMO notifications should be sufficient for this design. I’ve developed a pretty similar system purely using notifications b/c they are by far the fastest and smallest IPC mechanism available in FreeRTOS (you can disable almost all other OS features).
I think event_groups are an overkill.
But if you’re a lucky boy having no constraints regarding performance and code size you can choose the most convenient IPC :slight_smile:
Good luck !