FW: RTEMS Message Queue Behaviour
Jamie Bowman
jamie.bowman at steepestascent.com
Fri Apr 9 11:32:24 UTC 2010
Aleix
My apologies!
Good call on the rtems_message_queue_receive parameters. However by chance,
both RTEMS_WAIT and RTEMS_NO_TIMEOUT are defined as zero, so it wouldn't
change the parameters actually sent to rtems_message_queue_receive.
Kind regards
Jamie
Jamie Bowman
Steepest Ascent Ltd
Ladywell, 94 Duke Street, Glasgow, G4 0UW, UK
t: +44 (0) 141 552 8855
e: jamie at steepestascent.com
w: www.steepestascent.com
-----Original Message-----
From: aconchillo at gmail.com [mailto:aconchillo at gmail.com] On Behalf Of Aleix
Conchillo Flaqué
Sent: 09 April 2010 12:09
To: Jamie.Bowman at steepestascent.com
Cc: rtems-users at rtems.org
Subject: Re: RTEMS Message Queue Behaviour
I think:
rtems_message_queue_receive(a0_mq, &MESSAGE, &LEN, RTEMS_NO_TIMEOUT, 0);
should be:
rtems_message_queue_receive(a0_mq, &MESSAGE, &LEN, RTEMS_WAIT,
RTEMS_NO_TIMEOUT);
I don't know if that's the problem.
Btw, it's Aleix (pronounced as Alesh) not Alexi ;-)
On Fri, Apr 9, 2010 at 12:35, Jamie Bowman
<jamie.bowman at steepestascent.com> wrote:
> Alexi
>
> A typical message queue is set up as follows:
>
> rtems_id a0_mq;
> rtems_message_queue_create( rtems_build_name('Q', 'U', 'E', 'A'), \
> 32,
> sizeof(LOGMSG),
> RTEMS_DEFAULT_ATTRIBUTES,
> &a0_mq);
>
> We send messages by doing the following:
>
> rtems_message_queue_send(a0_mq, (void*)&MESSAGE, sizeof(LOGMSG));
>
> And receive messages by doing the following:
>
> LOGMSG MESSAGE;
> size_t LEN = sizeof(LOGMSG);
> rtems_message_queue_receive(a0_mq, &MESSAGE, &LEN, RTEMS_NO_TIMEOUT, 0);
>
>
> Kind regards
>
> Jamie
>
> Jamie Bowman
> Steepest Ascent Ltd
> Ladywell, 94 Duke Street, Glasgow, G4 0UW, UK
> t: +44 (0) 141 552 8855
> e: jamie at steepestascent.com
> w: www.steepestascent.com
>
> -----Original Message-----
> From: aconchillo at gmail.com [mailto:aconchillo at gmail.com] On Behalf Of
Aleix
> Conchillo Flaqué
> Sent: 09 April 2010 11:25
> To: Jamie.Bowman at steepestascent.com
> Cc: rtems-users at rtems.org
> Subject: Re: RTEMS Message Queue Behaviour
>
> How (parameters) do you create the message queues?
>
> Aleix
>
> On Fri, Apr 9, 2010 at 12:21, Jamie Bowman
> <jamie.bowman at steepestascent.com> wrote:
>> Alexi
>>
>> Thank you very much for your quick response.
>>
>> We have been setting the CONFIGURE_MESSAGE_BUFFER_MEMORY parameter within
>> our configuration, at least to values we think appear to be appropriate.
> We
>> have the following set:
>>
>> #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 18
>> #define CONFIGURE_MESSAGE_BUFFER_MEMORY 18*32*sizeof(LOGMSG)
>> //NO x DEPTH x SIZE
>>
>> Our system has around 16 threads running, each of which has been
> configured
>> to have a stack size of 8*RTEMS_MINIMUM_STACK_SIZE which is more than
>> adequate for each task.
>>
>> We configure our tasks as follows to accommodate the number of tasks and
> the
>> larger than default stack sizes:
>>
>> #define CONFIGURE_MAXIMUM_TASKS 18
>> #define CONFIGURE_EXTRA_TASK_STACKS
> (18*(8-1)*RTEMS_MINIMUM_STACK_SIZE)
>> #define CONFIGURE_MAXIMUM_SEMAPHORES 96
>>
>> Are there any other configuration parameters we should be setting to
>> accommodate our setup?
>>
>> Kind regards
>>
>> Jamie
>>
>> Jamie Bowman
>> Steepest Ascent Ltd
>> Ladywell, 94 Duke Street, Glasgow, G4 0UW, UK
>> t: +44 (0) 141 552 8855
>> e: jamie at steepestascent.com
>> w: www.steepestascent.com
>>
>> -----Original Message-----
>> From: aconchillo at gmail.com [mailto:aconchillo at gmail.com] On Behalf Of
> Aleix
>> Conchillo Flaqué
>> Sent: 09 April 2010 11:10
>> To: Jamie.Bowman at steepestascent.com
>> Cc: rtems-users at rtems.org
>> Subject: Re: RTEMS Message Queue Behaviour
>>
>> A while ago I experienced strange problems with queues until I
>> configured the memory for them. In 4.6.6 CONFIGURE_MEMORY_OVERHEAD
>> defines the number of kbytes necessary to fit your queue messages and
>> CONFIGURE_MESSAGE_BUFFER_MEMORY for newer RTEMS versions. Buffers are
>> not taken into account when reserving memory for message queues.
>>
>> Hope it helps,
>>
>> Aleix
>>
>> On Fri, Apr 9, 2010 at 11:56, Jamie Bowman
>> <jamie.bowman at steepestascent.com> wrote:
>>> All
>>>
>>>
>>>
>>> I am experiencing some strange behaviour with RTEMS message queues,
>> although
>>> I suspect the problem may more to be with the main configuration of the
>>> application.
>>>
>>>
>>>
>>> I have a multi-threaded system, with a central logging thread.
> Information
>>> is sent from each thread to the logging thread via a single logging
> thread
>>> message queue. At the moment the logging thread simply uses a printf to
>>> output the messages it receives. The behaviour we are seeing though is
>> that
>>> the logging thread is in a certain instances reading the messages out of
>> the
>>> queue in the wrong order and it also seems that some messages are going
>>> missing all together. Monitoring the return of the
>> rtems_message_queue_send
>>> does not seem to reveal any issues with RTEMS_SUCCESSFUL returned every
>>> time. An example of what I am seeing is as follows:
>>>
>>>
>>>
>>> Sent: Message 1
>>>
>>> Sent: Message 2
>>>
>>> Sent: Message 3
>>>
>>> Sent: Message 4
>>>
>>> Sent: Message 5
>>>
>>> Sent: Message 6
>>>
>>> Sent: Message 7
>>>
>>>
>>>
>>> LOGGING THREAD
>>>
>>> Read: Message 1
>>>
>>> Read: Message 2
>>>
>>> Read: Message 4
>>>
>>> Read: Message 3
>>>
>>> Read: Message 5
>>>
>>>
>>>
>>> Messages 3 and 4 are out of order and 6 and 7 never seem to get through.
>>>
>>>
>>>
>>> Does anyone have any ideas as to why this may be happening? I am using
>> RTEMS
>>> 4.8.1.
>>>
>>>
>>>
>>> Kind regards
>>>
>>>
>>>
>>> Jamie
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> rtems-users mailing list
>>> rtems-users at rtems.org
>>> http://www.rtems.org/mailman/listinfo/rtems-users
>>>
>>>
>>
>>
>
>
More information about the users
mailing list