public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* RE: [ECOS] POSIX Queue Suspension
@ 2005-06-20 21:58 Ali, Khurram
  2005-06-20 23:47 ` Gary Thomas
  0 siblings, 1 reply; 5+ messages in thread
From: Ali, Khurram @ 2005-06-20 21:58 UTC (permalink / raw)
  To: Ali, Khurram, Andrew Lunn; +Cc: eCos Discussion

FYI

I got the latest source using anonymous cvs. Used the default
configuration with POSIX support. I see the behavior which I was
expecting.

I now have another question: How do I add support for printf? Which
library is this part of? I am using an x86 PC as my target.

Thank you,
Khurram

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Ali,
Khurram
Sent: Monday, June 20, 2005 1:49 PM
To: Andrew Lunn
Cc: eCos Discussion
Subject: RE: [ECOS] POSIX Queue Suspension

> If more than one thread is waiting to receive a message when a message
> arrives at an empty queue and the Priority Scheduling option is
supported, 
> then the thread of highest priority that has been waiting the longest 
> shall be selected to receive the message.

Thread L is the highest priority thread that has been waiting the
longest. Shouldn't it be resumed first?

Agreed that other threads also have the same priority, but since there
is an additional restriction of "waiting the longest" I would assume
that we can have two or more threads at the same priority?

Am I missing something?

Khurram

-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch] 
Sent: Monday, June 20, 2005 12:22 PM
To: Ali, Khurram
Cc: eCos Discussion
Subject: Re: [ECOS] POSIX Queue Suspension

On Mon, Jun 20, 2005 at 10:54:00AM -0500, Ali, Khurram wrote:
> Hello,
> 
> I have two POSIX threads that are waiting to receive on a POSIX queue.
> Thread L suspends on the queue first. Thread K then suspends on the
> queue. However, when Thread J sends an element to the queue. Thread K
is
> resumed first. 
> 
> All threads have the same priority. All queue accesses are also made
> with the same priority. Shouldn't Thread L be resumed first. 
> 
> What could I be doing wrong?

You don't seem to of read the POSIX standard. 

http://www.opengroup.org/onlinepubs/009695399/functions/mq_receive.html

If the specified message queue is empty and O_NONBLOCK is not set in
the message queue description associated with mqdes, mq_receive()
shall block until a message is enqueued on the message queue or until
mq_receive() is interrupted by a signal. If more than one thread is
waiting to receive a message when a message arrives at an empty queue
and the Priority Scheduling option is supported, then the thread of
highest priority that has been waiting the longest shall be selected
to receive the message. Otherwise, it is unspecified which waiting
thread receives the message. If the specified message queue is empty
and O_NONBLOCK is set in the message queue description associated with
mqdes, no message shall be removed from the queue, and mq_receive()
shall return an error.

So eCos behavious seems correct to me.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [ECOS] POSIX Queue Suspension
  2005-06-20 21:58 [ECOS] POSIX Queue Suspension Ali, Khurram
@ 2005-06-20 23:47 ` Gary Thomas
  0 siblings, 0 replies; 5+ messages in thread
From: Gary Thomas @ 2005-06-20 23:47 UTC (permalink / raw)
  To: Ali, Khurram; +Cc: Andrew Lunn, eCos Discussion

On Mon, 2005-06-20 at 16:58 -0500, Ali, Khurram wrote:
> FYI
> 
> I got the latest source using anonymous cvs. Used the default
> configuration with POSIX support. I see the behavior which I was
> expecting.
> 
> I now have another question: How do I add support for printf? Which
> library is this part of? I am using an x86 PC as my target.
> 

What kind of support do you think you need?  If you have the POSIX
environment running, you've everything already.

Perhaps you're asking about [interrupt driven] serial drivers?

> Thank you,
> Khurram
> 
> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Ali,
> Khurram
> Sent: Monday, June 20, 2005 1:49 PM
> To: Andrew Lunn
> Cc: eCos Discussion
> Subject: RE: [ECOS] POSIX Queue Suspension
> 
> > If more than one thread is waiting to receive a message when a message
> > arrives at an empty queue and the Priority Scheduling option is
> supported, 
> > then the thread of highest priority that has been waiting the longest 
> > shall be selected to receive the message.
> 
> Thread L is the highest priority thread that has been waiting the
> longest. Shouldn't it be resumed first?
> 
> Agreed that other threads also have the same priority, but since there
> is an additional restriction of "waiting the longest" I would assume
> that we can have two or more threads at the same priority?
> 
> Am I missing something?
> 
> Khurram
> 
> -----Original Message-----
> From: Andrew Lunn [mailto:andrew@lunn.ch] 
> Sent: Monday, June 20, 2005 12:22 PM
> To: Ali, Khurram
> Cc: eCos Discussion
> Subject: Re: [ECOS] POSIX Queue Suspension
> 
> On Mon, Jun 20, 2005 at 10:54:00AM -0500, Ali, Khurram wrote:
> > Hello,
> > 
> > I have two POSIX threads that are waiting to receive on a POSIX queue.
> > Thread L suspends on the queue first. Thread K then suspends on the
> > queue. However, when Thread J sends an element to the queue. Thread K
> is
> > resumed first. 
> > 
> > All threads have the same priority. All queue accesses are also made
> > with the same priority. Shouldn't Thread L be resumed first. 
> > 
> > What could I be doing wrong?
> 
> You don't seem to of read the POSIX standard. 
> 
> http://www.opengroup.org/onlinepubs/009695399/functions/mq_receive.html
> 
> If the specified message queue is empty and O_NONBLOCK is not set in
> the message queue description associated with mqdes, mq_receive()
> shall block until a message is enqueued on the message queue or until
> mq_receive() is interrupted by a signal. If more than one thread is
> waiting to receive a message when a message arrives at an empty queue
> and the Priority Scheduling option is supported, then the thread of
> highest priority that has been waiting the longest shall be selected
> to receive the message. Otherwise, it is unspecified which waiting
> thread receives the message. If the specified message queue is empty
> and O_NONBLOCK is set in the message queue description associated with
> mqdes, no message shall be removed from the queue, and mq_receive()
> shall return an error.
> 
> So eCos behavious seems correct to me.
> 
>         Andrew
> 
> -- 
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
> 
> 
-- 
Gary Thomas <gary@chez-thomas.org>


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [ECOS] POSIX Queue Suspension
@ 2005-06-20 18:49 Ali, Khurram
  0 siblings, 0 replies; 5+ messages in thread
From: Ali, Khurram @ 2005-06-20 18:49 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: eCos Discussion

> If more than one thread is waiting to receive a message when a message
> arrives at an empty queue and the Priority Scheduling option is
supported, 
> then the thread of highest priority that has been waiting the longest 
> shall be selected to receive the message.

Thread L is the highest priority thread that has been waiting the
longest. Shouldn't it be resumed first?

Agreed that other threads also have the same priority, but since there
is an additional restriction of "waiting the longest" I would assume
that we can have two or more threads at the same priority?

Am I missing something?

Khurram

-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch] 
Sent: Monday, June 20, 2005 12:22 PM
To: Ali, Khurram
Cc: eCos Discussion
Subject: Re: [ECOS] POSIX Queue Suspension

On Mon, Jun 20, 2005 at 10:54:00AM -0500, Ali, Khurram wrote:
> Hello,
> 
> I have two POSIX threads that are waiting to receive on a POSIX queue.
> Thread L suspends on the queue first. Thread K then suspends on the
> queue. However, when Thread J sends an element to the queue. Thread K
is
> resumed first. 
> 
> All threads have the same priority. All queue accesses are also made
> with the same priority. Shouldn't Thread L be resumed first. 
> 
> What could I be doing wrong?

You don't seem to of read the POSIX standard. 

http://www.opengroup.org/onlinepubs/009695399/functions/mq_receive.html

If the specified message queue is empty and O_NONBLOCK is not set in
the message queue description associated with mqdes, mq_receive()
shall block until a message is enqueued on the message queue or until
mq_receive() is interrupted by a signal. If more than one thread is
waiting to receive a message when a message arrives at an empty queue
and the Priority Scheduling option is supported, then the thread of
highest priority that has been waiting the longest shall be selected
to receive the message. Otherwise, it is unspecified which waiting
thread receives the message. If the specified message queue is empty
and O_NONBLOCK is set in the message queue description associated with
mqdes, no message shall be removed from the queue, and mq_receive()
shall return an error.

So eCos behavious seems correct to me.

        Andrew

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] POSIX Queue Suspension
  2005-06-20 15:54 Ali, Khurram
@ 2005-06-20 17:22 ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2005-06-20 17:22 UTC (permalink / raw)
  To: Ali, Khurram; +Cc: eCos Discussion

On Mon, Jun 20, 2005 at 10:54:00AM -0500, Ali, Khurram wrote:
> Hello,
> 
> I have two POSIX threads that are waiting to receive on a POSIX queue.
> Thread L suspends on the queue first. Thread K then suspends on the
> queue. However, when Thread J sends an element to the queue. Thread K is
> resumed first. 
> 
> All threads have the same priority. All queue accesses are also made
> with the same priority. Shouldn't Thread L be resumed first. 
> 
> What could I be doing wrong?

You don't seem to of read the POSIX standard. 

http://www.opengroup.org/onlinepubs/009695399/functions/mq_receive.html

If the specified message queue is empty and O_NONBLOCK is not set in
the message queue description associated with mqdes, mq_receive()
shall block until a message is enqueued on the message queue or until
mq_receive() is interrupted by a signal. If more than one thread is
waiting to receive a message when a message arrives at an empty queue
and the Priority Scheduling option is supported, then the thread of
highest priority that has been waiting the longest shall be selected
to receive the message. Otherwise, it is unspecified which waiting
thread receives the message. If the specified message queue is empty
and O_NONBLOCK is set in the message queue description associated with
mqdes, no message shall be removed from the queue, and mq_receive()
shall return an error.

So eCos behavious seems correct to me.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ECOS] POSIX Queue Suspension
@ 2005-06-20 15:54 Ali, Khurram
  2005-06-20 17:22 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Ali, Khurram @ 2005-06-20 15:54 UTC (permalink / raw)
  To: eCos Discussion

Hello,

I have two POSIX threads that are waiting to receive on a POSIX queue.
Thread L suspends on the queue first. Thread K then suspends on the
queue. However, when Thread J sends an element to the queue. Thread K is
resumed first. 

All threads have the same priority. All queue accesses are also made
with the same priority. Shouldn't Thread L be resumed first. 

What could I be doing wrong?

Appreciate any help.

Thank you,
Khurram

---------------------------------------
M. Khurram Ali - khurram_ali@mentor.com 
Software Engineer

Accelerated Technology,
A Mentor Graphics Division

739 North University Blvd. 
Mobile, AL 36608

www.mentor.com/embedded
---------------------------------------


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-06-20 23:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-20 21:58 [ECOS] POSIX Queue Suspension Ali, Khurram
2005-06-20 23:47 ` Gary Thomas
  -- strict thread matches above, loose matches on Subject: below --
2005-06-20 18:49 Ali, Khurram
2005-06-20 15:54 Ali, Khurram
2005-06-20 17:22 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).