public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Question on Posix Select function
@ 2006-06-19  9:17 e.coullien
  2006-06-20 10:34 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: e.coullien @ 2006-06-19  9:17 UTC (permalink / raw)
  To: ecos-discuss



We are working on a package to complete the eCos Intrument package for
communicating with a PC software through Ethernet. The goal is to record in real
time the Instrument informations from the board to the PC and to watch a graph
to show tasks and other instrument traces.
If someone is interresting on, we can share it...

We began to graph a module with a SELECT function but we have some difficulties
to understand what we see on the Graph.
In a task, before sending, we call the select function. In fact the task which
calls the SELECT function is switching on even if the driver is not ready to
send.
So the graph shows that this task is active very often instead to sleep until
the driver is ready to send.
Do someone know how to explain this phenomenon and how does the Posix select
function really work ?

Thank you,

Emmanuel Coullien



































-- 
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] 2+ messages in thread

* Re: [ECOS] Question on Posix Select function
  2006-06-19  9:17 [ECOS] Question on Posix Select function e.coullien
@ 2006-06-20 10:34 ` Andrew Lunn
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2006-06-20 10:34 UTC (permalink / raw)
  To: e.coullien; +Cc: ecos-discuss

On Mon, Jun 19, 2006 at 11:17:42AM +0200, e.coullien@faiveley.com wrote:
> 
> 

> We are working on a package to complete the eCos Intrument package
> for communicating with a PC software through Ethernet. The goal is
> to record in real time the Instrument informations from the board to
> the PC and to watch a graph to show tasks and other instrument
> traces.

Interesting. How do you solve the obvious race condition that using
the network to send the events generate events?

Ideally you should use the RedBoot network stack for this. 

> We began to graph a module with a SELECT function but we have some
> difficulties to understand what we see on the Graph.  In a task,
> before sending, we call the select function. In fact the task which
> calls the SELECT function is switching on even if the driver is not
> ready to send.  So the graph shows that this task is active very
> often instead to sleep until the driver is ready to send.  Do
> someone know how to explain this phenomenon and how does the Posix
> select function really work ?

There is pritty good comments in the code. Have you read them:

// A flag is used to block a thread until data from the device is
// available. This prevents all threads from waking up at the same
// time and polling for changes.  Each thread is allocated a flag bit
// via the SELECT_WAIT_FLAG_GET() macro when the thread registers for
// selection via cyg_selrecord (). The flag is stored in the driver's
// select info block. Only those threads specified via the flags in
// the select info are woken up by cyg_selwakeup ().  If there are
// more than 32 threads in the system, then there is a chance that
// cyg_selwakeup () may wake up more than one thread. Each thread then
// polls for changes.

So you probably have the same bit set as some other thread using the network.

  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] 2+ messages in thread

end of thread, other threads:[~2006-06-20 10:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-19  9:17 [ECOS] Question on Posix Select function e.coullien
2006-06-20 10:34 ` 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).