Regarding message queues - VxWorks

This is a discussion on Regarding message queues - VxWorks ; Hi, I want to implement a priority based message queue with both high priority as well as low-priority messages processed in a FIFO manner.As you all might know the messages posted to the queue with a prio "MSG_PRI_URGENT" are put ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Regarding message queues

  1. Regarding message queues

    Hi,

    I want to implement a priority based message queue with both high
    priority as well as low-priority messages processed in a FIFO
    manner.As you all might know the messages posted to the queue with a
    prio "MSG_PRI_URGENT" are put at the head of the queue and those with
    "MSG_PRI_NORMAL" are put at the tail of the Q. But I need to queue the
    High priority messages in FIFO manner, which is not possible with the
    APIs supported by Vxworks.Kindly let me know how to implement the
    same....

    Regards,
    Sandeep


  2. Re: Regarding message queues

    On Oct 15, 6:00 pm, sandeepmjosh...@gmail.com wrote:
    > Hi,
    >
    > I want to implement a priority based message queue with both high
    > priority as well as low-priority messages processed in a FIFO
    > manner.As you all might know the messages posted to the queue with a
    > prio "MSG_PRI_URGENT" are put at the head of the queue and those with
    > "MSG_PRI_NORMAL" are put at the tail of the Q. But I need to queue the
    > High priority messages in FIFO manner, which is not possible with the
    > APIs supported by Vxworks.Kindly let me know how to implement the
    > same....
    >
    > Regards,
    > Sandeep


    Hi,
    Why not change the design if you have enough memory,implement one
    queue for high priority messages and another for low priority.This way
    you can manage what you are expecting.As said by you Vxworks does not
    allow what you are trying to do.I dont think having 2 queues is going
    to be a big overhead in terms of memory because even without this you
    are going to have a single queue with size accomodating both low prio
    and high prio messages which would be more or less same then having 2
    queues.The only memory increament you could see by creating second
    queue would be for maintaining the queue data structure.
    Regards,
    s.subbarayan


  3. Re: Regarding message queues

    On Oct 16, 5:51 pm, ssubbarayan wrote:
    > On Oct 15, 6:00 pm, sandeepmjosh...@gmail.com wrote:
    >
    > > Hi,

    >
    > > I want to implement a priority based message queue with both high
    > > priority as well as low-priority messages processed in a FIFO
    > > manner.As you all might know the messages posted to the queue with a
    > > prio "MSG_PRI_URGENT" are put at the head of the queue and those with
    > > "MSG_PRI_NORMAL" are put at the tail of the Q. But I need to queue the
    > > High priority messages in FIFO manner, which is not possible with the
    > > APIs supported by Vxworks.Kindly let me know how to implement the
    > > same....

    >
    > > Regards,
    > > Sandeep

    >
    > Hi,
    > Why not change the design if you have enough memory,implement one
    > queue for high priority messages and another for low priority.This way
    > you can manage what you are expecting.As said by you Vxworks does not
    > allow what you are trying to do.I dont think having 2 queues is going
    > to be a big overhead in terms of memory because even without this you
    > are going to have a single queue with size accomodating both low prio
    > and high prio messages which would be more or less same then having 2
    > queues.The only memory increament you could see by creating second
    > queue would be for maintaining the queue data structure.
    > Regards,
    > s.subbarayan


    Hi,
    In the current scenario there is a single task pending on both High-
    Prio as well as Low-prio messages so by using two seperate queues task
    synchronization is not possible.... Its a real tricky situation :-
    ( ...In case we use two queues one of the queues has to be processed
    in polling mode, which is not an ideal thing to do as it would block
    the dequeueing of messages from the other queue....

    Regards,
    Sandeep


  4. Re: Regarding message queues

    On Oct 16, 3:53 pm, sandeepmjosh...@gmail.com wrote:
    >
    > Hi,
    > In the current scenario there is a single task pending on both High-
    > Prio as well as Low-prio messages so by using two seperate queues task
    > synchronization is not possible.... Its a real tricky situation :-
    > ( ...In case we use two queues one of the queues has to be processed
    > in polling mode, which is not an ideal thing to do as it would block
    > the dequeueing of messages from the other queue....


    You might want to check out "events" in "eventLib".
    Events can be used to wait on multiple objects (queues, semaphores,
    etc).

    In your initialization code, do something like:

    -----
    #define HIGH_Q_EVENT 0x01
    #define LOW_Q_EVENT 0x02
    MSG_Q_ID lowQ, highQ ;
    lowQ = msgQCreate ( ... ) ;
    highQ = msgQCreate ( ... ) ;

    msgQEvStart(lowQ, LOW_Q_EVENT,0);
    msgQEvStart(highQ, HIGH_Q_EVENT,0);
    -----

    Then,

    In your single task, instead of msgQReceive, do the following:
    ---
    UINT32 whichEvents;

    /* This call will BLOCK until a msg arrives in one of the queues */
    eventReceive (
    LOW_Q_EVENT | HIGH_Q_EVENT, /* events to wait for */
    EVENT_WAIT_ANY, /* wait options */
    WAIT_FOREVER, /* event timeout */
    &whichEvents ) ;

    if (whichEvents & LOW_Q_EVENT) {
    msgQReceive ( lowQ .... ) ;
    };
    if (whichEvents & HIGH_Q_EVENT) {
    msgQReceive ( highQ .... ) ;
    }
    ------

    Note that events have many technical details that must be observed,
    and you should read the manual before using them.

    Regards,
    Allen.


  5. Re: Regarding message queues

    On Oct 16, 8:41 pm, "A.Holden" wrote:
    > On Oct 16, 3:53 pm, sandeepmjosh...@gmail.com wrote:
    >
    >
    >
    > > Hi,
    > > In the current scenario there is a single task pending on both High-
    > > Prio as well as Low-prio messages so by using two seperate queues task
    > > synchronization is not possible.... Its a real tricky situation :-
    > > ( ...In case we use two queues one of the queues has to be processed
    > > in polling mode, which is not an ideal thing to do as it would block
    > > the dequeueing of messages from the other queue....

    >
    > You might want to check out "events" in "eventLib".
    > Events can be used to wait on multiple objects (queues, semaphores,
    > etc).
    >
    > In your initialization code, do something like:
    >
    > -----
    > #define HIGH_Q_EVENT 0x01
    > #define LOW_Q_EVENT 0x02
    > MSG_Q_ID lowQ, highQ ;
    > lowQ = msgQCreate ( ... ) ;
    > highQ = msgQCreate ( ... ) ;
    >
    > msgQEvStart(lowQ, LOW_Q_EVENT,0);
    > msgQEvStart(highQ, HIGH_Q_EVENT,0);
    > -----
    >
    > Then,
    >
    > In your single task, instead of msgQReceive, do the following:
    > ---
    > UINT32 whichEvents;
    >
    > /* This call will BLOCK until a msg arrives in one of the queues */
    > eventReceive (
    > LOW_Q_EVENT | HIGH_Q_EVENT, /* events to wait for */
    > EVENT_WAIT_ANY, /* wait options */
    > WAIT_FOREVER, /* event timeout */
    > &whichEvents ) ;
    >
    > if (whichEvents & LOW_Q_EVENT) {
    > msgQReceive ( lowQ .... ) ;};
    >
    > if (whichEvents & HIGH_Q_EVENT) {
    > msgQReceive ( highQ .... ) ;}
    >
    > ------
    >
    > Note that events have many technical details that must be observed,
    > and you should read the manual before using them.
    >
    > Regards,
    > Allen.


    Hi Allen,
    Thanks a lot for ur inputs...It was really useful....

    Regards,
    Sandeep


+ Reply to Thread