Solved

message Q on VXWORKS operating system

Posted on 2002-06-13
7
1,270 Views
Last Modified: 2013-12-06
Dear Experts,

I need to know the principle of a message q with the VXWORKS operating system.

also i'll be delighted for any links on the subject, as well as on semaphore and tasks handling with the VXWORKS operating system

Thanks.
0
Comment
Question by:ronyjosf
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 17

Expert Comment

by:Wakeup
ID: 7077096
I dont know anything about VXWorks, but you can check some of these sites out for information:

http://www.windriver.com/products/html/vxwks54.html
http://www.xs4all.nl/~borkhuis/vxworks/vxworks.html
http://www.faqs.org/faqs/vxworks-faq/part1/
http://www.xs4all.nl/~borkhuis/vxworks/vxfaq.html


Hope those may be able to answer your questions!
0
 
LVL 11

Expert Comment

by:dimitry
ID: 7079118
Actually VxWorks programmer's Guide has all the nesessary
information. The chapter is too big and EE doesn't allow to paste pictures. Do you have some specific problem ?
--------------------------------------------------------
2.4.4   Message Queues
Modern real-time applications are constructed as a set of independent but cooperating tasks. While semaphores provide a high-speed mechanism for the synchronization and interlocking of tasks, often a higher-level mechanism is necessary to allow cooperating tasks to communicate with each other. In VxWorks, the primary intertask communication mechanism within a single CPU is message queues. The optional product, VxMP, provides global message queues that can be used across processors; for more information, see 6. Shared-Memory Objects.

Message queues allow a variable number of messages, each of variable length, to be queued. Any task or ISR can send messages to a message queue. Any task can receive messages from a message queue. Multiple tasks can send to and receive from the same message queue. Full-duplex communication between two tasks generally requires two message queues, one for each direction; see Figure 2-14.

Figure 2-14:  Full Duplex Communication Using Message Queues
 
There are two message-queue subroutine libraries in VxWorks. The first of these, msgQLib, provides Wind message queues, designed expressly for VxWorks; the second, mqPxLib, is compatible with the POSIX standard (1003.1b) for real-time extensions. See Comparison of POSIX and Wind Message Queues for a discussion of the differences between the two message-queue designs.

0
 
LVL 3

Expert Comment

by:ITsheresomewhere
ID: 7133402
Hello ronyjosf,

It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. If there is no objection or further activity, I will suggest to:

    Split points between: Wakeup and dimitry

ronyjosf, if you think your question was not answered at all, you can post a request in Community Support and ask them to delete this question and refund your points (please include a link to this
Question: http:Q.20311252.html in any posts to Community Support).
If you want to post to Community Support, click here:
      http://www.experts-exchange.com/jsp/qAskQuestion.jsp?ta=commspt

Please do not accept this comment as an answer!

EXPERTS: Your input for closing recommendations is appreciated.
==========
ITsheresomewhere
EE Database Cleanup Volunteer
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:ronyjosf
ID: 7135769
Dimitry hi,

Sorry it took me that long... but could you be more specific on the way messageQ works ?
in terms on send, recieve, waitforsingleobject, and so long...

Thanks, Rony.
0
 
LVL 11

Accepted Solution

by:
dimitry earned 150 total points
ID: 7135784
As I wrote there are two libraries for messages in VxWorks:
Wind and Posix. Let's consider Wind functions:

Wind message queues are created and deleted with the routines shown in Table 2-17. This library provides messages that are queued in FIFO order, with a single exception: there are two priority levels, and messages marked as high priority are attached to the head of the queue.

Table 2-17:  Wind Message Queue Control

-----------------------------------------------------------
Call Description  
-----------------------------------------------------------
msgQCreate( )   Allocate and initialize a message queue.  
msgQDelete( )   Terminate and free a message queue.  
msgQSend( )   Send a message to a message queue.  
msgQReceive( )   Receive a message from a message queue.  
-----------------------------------------------------------

A message queue is created with msgQCreate( ). Its parameters specify the maximum number of messages that can be queued in the message queue and the maximum length in bytes of each message. Enough buffer space is preallocated for the specified number and length of messages.

A task or ISR sends a message to a message queue with msgQSend( ). If no tasks are waiting for messages on that queue, the message is added to the queue's buffer of messages. If any tasks are already waiting for a message from that message queue, the message is immediately delivered to the first waiting task.

A task receives a message from a message queue with msgQReceive( ). If messages are already available in the message queue's buffer, the first message is immediately dequeued and returned to the caller. If no messages are available, then the calling task blocks and is added to a queue of tasks waiting for messages. This queue of waiting tasks can be ordered either by task priority or FIFO, as specified in an option parameter when the queue is created.

Example 2-8:  Wind Message Queues
/* In this example, task t1 creates the message queue and sends a message
 * to task t2. Task t2 receives the message from the queue and simply
 * displays the message.
 */
 
/* includes */
#include "vxWorks.h"
#include "msgQLib.h"
 
/* defines */
#define MAX_MSGS (10)
#define MAX_MSG_LEN (100)
 
MSG_Q_ID myMsgQId;
 
task2 (void)
    {
    char msgBuf[MAX_MSG_LEN];
 
    /* get message from queue; if necessary wait until msg is available */
    if (msgQReceive(myMsgQId, msgBuf, MAX_MSG_LEN, WAIT_FOREVER) == ERROR)
        return (ERROR);
 
    /* display message */
    printf ("Message from task 1:\n%s\n", msgBuf);
    }
 
#define MESSAGE "Greetings from Task 1"
task1 (void)
    {
    /* create message queue */
    if ((myMsgQId = msgQCreate (MAX_MSGS, MAX_MSG_LEN, MSG_Q_PRIORITY))  
        == NULL)
        return (ERROR);
 
    /* send a normal priority message, blocking if queue is full */
    if (msgQSend (myMsgQId, MESSAGE, sizeof (MESSAGE), WAIT_FOREVER,
                  MSG_PRI_NORMAL) == ERROR)
        return (ERROR);
    }
0
 
LVL 3

Expert Comment

by:ITsheresomewhere
ID: 7135796
Thank you both for responding.
I have suspended the recommendation pending the thread
remaining active.

ITsheresomewhere
0
 

Author Comment

by:ronyjosf
ID: 7160462
You've been very helpfull !
Thank you.
Rony.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
If your app took Google’s lash recently, here are the 5 most likely reasons.
The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now