This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: I have a problem with the priority of ecos
- From: John Dallaway <john at dallaway dot org dot uk>
- To: moktar_bouain <moktarbouain at yahoo dot fr>
- Cc: eCos Discussion <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 14 Apr 2011 08:36:09 +0100
- Subject: [ECOS] Re: I have a problem with the priority of ecos
- References: <31383032.post@talk.nabble.com>
[ moving to ecos-discuss ]
Hi Moktar
moktar_bouain wrote:
> void cyg_user_start(void)
> {
> printf("Entering twothreads' cyg_user_start() function\n");
>
> cyg_mutex_init(&cliblock);
>
> cyg_thread_create(10, taska, (cyg_addrword_t) 0,"Thread A", (void *)
> stack[0], 4096,&simple_threadA, &thread_s[0]);
> cyg_thread_create(0, taskb, (cyg_addrword_t) 1,"Thread B", (void *)
> stack[1], 4096,&simple_threadB, &thread_s[1]);
> }
>
> void main (cyg_addrword_t data)
> {
> for(;;)
> {
> cyg_thread_resume(simple_threadA);
> cyg_thread_resume(simple_threadB);
> }
> }
>
> when I execute this configuration:
> TASKB
> TASKB
> TASKB
> TASKB
> TASKB
> TASKB
> TASKB
> TASKB
> TASKB
> TASKB
> TASKB
It looks like the issue is with main() which will run as an eCos thread
at priority 10 by default (CYGNUM_LIBC_MAIN_THREAD_PRIORITY). The bitmap
scheduler will not handle two threads at the same priority correctly.
Assuming you have a good reason to use main() and to restart the
application threads in this way, main() should be of lower priority than
the other threads.
I hope this helps...
John Dallaway
eCos maintainer
http://www.dallaway.org.uk/john
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss