public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Problem with multiple threads
@ 2009-03-30 16:31 Himanshu Patel
  2009-03-30 17:32 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Himanshu Patel @ 2009-03-30 16:31 UTC (permalink / raw)
  To: eCos Discuss

Hi All,

We are developing application with multiple threads. Application with
two threads are running without any issues (with both the threads are
getting time slice).

Now I have requirement of adding one more thread. What is observed that,
now one of the threads gets time slice only once and then control never
return back to that thread. Priority of all the threads are equal. So
ideally all threads should get equal time slice. All three threads are
independent (not synchronized with any synchronization primitive). 

What could be the issue? Any suggestion?

Regards,

Himanshu Patel  

--
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] Problem with multiple threads
  2009-03-30 16:31 [ECOS] Problem with multiple threads Himanshu Patel
@ 2009-03-30 17:32 ` Andrew Lunn
  2009-03-31  9:49   ` Himanshu Patel
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2009-03-30 17:32 UTC (permalink / raw)
  To: Himanshu Patel; +Cc: eCos Discuss

On Mon, Mar 30, 2009 at 07:49:45PM +0530, Himanshu Patel wrote:
> Hi All,
> 
> We are developing application with multiple threads. Application with
> two threads are running without any issues (with both the threads are
> getting time slice).
> 
> Now I have requirement of adding one more thread. What is observed that,
> now one of the threads gets time slice only once and then control never
> return back to that thread. Priority of all the threads are equal. So
> ideally all threads should get equal time slice. All three threads are
> independent (not synchronized with any synchronization primitive). 
> 
> What could be the issue? Any suggestion?

There are synchronisation primitives hiding where you don't initially
think. eg printf.

Try playing with:

http://ecos.sourceware.org/docs-latest/user-guide/kernel-instrumentation.html

        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] Problem with multiple threads
  2009-03-30 17:32 ` Andrew Lunn
@ 2009-03-31  9:49   ` Himanshu Patel
  2009-03-31 10:03     ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Himanshu Patel @ 2009-03-31  9:49 UTC (permalink / raw)
  To: 'Andrew Lunn'; +Cc: 'eCos Discuss'

Hi Andrew,

We have selected CYGSEM_LIBC_STDIO_THREAD_SAFE_STREAMS option. So printf
should thread safe. Right? 

We would try playing with
http://ecos.sourceware.org/docs-latest/user-guide/kernel-instrumentation.htm
l and see. 

Regards,

Himanshu Patel

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Andrew Lunn
Sent: Monday, March 30, 2009 7:55 PM
To: Himanshu Patel
Cc: eCos Discuss
Subject: Re: [ECOS] Problem with multiple threads

On Mon, Mar 30, 2009 at 07:49:45PM +0530, Himanshu Patel wrote:
> Hi All,
> 
> We are developing application with multiple threads. Application with
> two threads are running without any issues (with both the threads are
> getting time slice).
> 
> Now I have requirement of adding one more thread. What is observed that,
> now one of the threads gets time slice only once and then control never
> return back to that thread. Priority of all the threads are equal. So
> ideally all threads should get equal time slice. All three threads are
> independent (not synchronized with any synchronization primitive). 
> 
> What could be the issue? Any suggestion?

There are synchronisation primitives hiding where you don't initially
think. eg printf.

Try playing with:

http://ecos.sourceware.org/docs-latest/user-guide/kernel-instrumentation.htm
l
        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] Problem with multiple threads
  2009-03-31  9:49   ` Himanshu Patel
@ 2009-03-31 10:03     ` Andrew Lunn
  2009-04-03 12:58       ` Himanshu Patel
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2009-03-31 10:03 UTC (permalink / raw)
  To: Himanshu Patel; +Cc: 'Andrew Lunn', 'eCos Discuss'

On Mon, Mar 30, 2009 at 10:01:09PM +0530, Himanshu Patel wrote:
> Hi Andrew,
> 
> We have selected CYGSEM_LIBC_STDIO_THREAD_SAFE_STREAMS option. So printf
> should thread safe. Right? 

Sure it is thread safe. However to be thread safe it uses mutex's
which are a form of synchronization.

      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] Problem with multiple threads
  2009-03-31 10:03     ` Andrew Lunn
@ 2009-04-03 12:58       ` Himanshu Patel
  0 siblings, 0 replies; 5+ messages in thread
From: Himanshu Patel @ 2009-04-03 12:58 UTC (permalink / raw)
  To: 'Andrew Lunn'; +Cc: 'eCos Discuss'

Hi Andrew,

After explicitly synchronizing printf with mutex, time slicing is working as
expected (although we have enabled  CYGSEM_LIBC_STDIO_THREAD_SAFE_STREAMS).

Regards,

Himanshu Patel

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Andrew Lunn
Sent: Monday, March 30, 2009 11:02 PM
To: Himanshu Patel
Cc: 'Andrew Lunn'; 'eCos Discuss'
Subject: Re: [ECOS] Problem with multiple threads

On Mon, Mar 30, 2009 at 10:01:09PM +0530, Himanshu Patel wrote:
> Hi Andrew,
> 
> We have selected CYGSEM_LIBC_STDIO_THREAD_SAFE_STREAMS option. So printf
> should thread safe. Right? 

Sure it is thread safe. However to be thread safe it uses mutex's
which are a form of synchronization.

      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

end of thread, other threads:[~2009-04-03 12:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-30 16:31 [ECOS] Problem with multiple threads Himanshu Patel
2009-03-30 17:32 ` Andrew Lunn
2009-03-31  9:49   ` Himanshu Patel
2009-03-31 10:03     ` Andrew Lunn
2009-04-03 12:58       ` Himanshu Patel

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).