This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MessageQ synchronization

Other Parts Discussed in Thread: SYSBIOS

I'm creating MessageQ's for interprocessor communication (on a C6678
multicore processor) and am trying to understand if I need to have a
synchronizer for the queue.  The documentation exmamples in "SYS/BIOS
Inter-Processor Communication (IPC) and I/O User’s Guide" suggests I
do.  But the example code I'm looking at in image_processing/ipc
creates queues with a NULL parameter (no synchronizer).  It also calls
MessageQ_get with a MessgaeQ_FOREVER wait time.  What I would like to
do for our first implementation is call MesssageQ_get with a zero
timeout (polling). I see in the documentation that
xdc.runtime.knl.SyncNull is the proper synchronizer for polling - is
this the synchronizer set by default when a NULL parameter is set?
Also I see there is a choice between Hwi, Swi and Task thread models.
Since I am only running one thread per core and not interrupting the
thread does this choice have relevance?  What is the proper choice?

  • Kerry,

    Kerry Barnes said:

    I'm creating MessageQ's for interprocessor communication (on a C6678
    multicore processor) and am trying to understand if I need to have a
    synchronizer for the queue.  The documentation exmamples in "SYS/BIOS
    Inter-Processor Communication (IPC) and I/O User’s Guide" suggests I
    do.  But the example code I'm looking at in image_processing/ipc
    creates queues with a NULL parameter (no synchronizer).  It also calls
    MessageQ_get with a MessgaeQ_FOREVER wait time.  What I would like to
    do for our first implementation is call MesssageQ_get with a zero
    timeout (polling). I see in the documentation that
    xdc.runtime.knl.SyncNull is the proper synchronizer for polling - is
    this the synchronizer set by default when a NULL parameter is set?
    Also I see there is a choice between Hwi, Swi and Task thread models.
    Since I am only running one thread per core and not interrupting the
    thread does this choice have relevance?  What is the proper choice?

    The default Sync is ti.sysbios.syncs.SyncSem.  If you pass a NULL synchronizer, this is what you get.

    Between the three different threads, it really just depends on what your needs are.

    Hwi are for your interrupt handlers.

    Swi are "run to completion" and they do not block.  These take less memory because they run on the ISR or Hwi stack.

    Task allow blocking.  They require their own stack.

    If you only have a single thread per core sounds to me like, using Swi would make the most sense.  Also I think you could implement a MessageQ with a SyncSwi which would not require polling but instead the Swi is the callback function.  You would use a Task just to get the system going.  I've attached a two core example here.

    5141.testsMessageQ.zip