From: Gary Thomas <gary@mlbassoc.com>
To: moktar_bouain <moktarbouain@yahoo.fr>
Cc: ecos-devel@ecos.sourceware.org
Subject: Re: I have a problem with the priority of ecos
Date: Tue, 12 Apr 2011 21:33:00 -0000 [thread overview]
Message-ID: <4DA4C51B.2070409@mlbassoc.com> (raw)
In-Reply-To: <31383032.post@talk.nabble.com>
On 04/12/2011 03:25 PM, moktar_bouain wrote:
>
> Hello ,
> I have a problem with the priority of ecos.
> I have the following configuration:
>
> #include<cyg/kernel/kapi.h>
>
> #include<stdio.h>
> #include<math.h>
> #include<stdlib.h>
> cyg_thread thread_s[2];
> char stack[2][4096];
> cyg_handle_t simple_threadA, simple_threadB;
> cyg_mutex_t cliblock;
> void taska(cyg_addrword_t data)
> {
> printf("TASKA \n");
> }
> void taskb(cyg_addrword_t data)
> {
> printf("TASKB \n");
>
> }
>
> 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
>
> but when I changed the priority:
>
> cyg_thread_create(1, 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]);
> I find this false result
> TASKB
> TASKA
> TASKB
> TASKA
> TASKB
> TASKA
> TASKB
> TASKA
> TASKB
> TASKA
> TASKB
> TASKA
> TASKB
> TASKA
> TASKB
>
> Any help??
What scheduler are you using? (this controls how many priorities and what
type of priority mechanism is available)
Also, what makes you think that after a thread does a printf() call, it
should yield the CPU to the other thread? There is no reason for it and
in the simplest configuration printf() is just diag_printf() which is not
interrupt driven and there would never be a reason for one thread to lose
control of the CPU.
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
next prev parent reply other threads:[~2011-04-12 21:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-12 21:25 moktar_bouain
2011-04-12 21:33 ` Gary Thomas [this message]
2011-04-12 23:02 ` moktar_bouain
2011-04-13 0:02 ` Gary Thomas
2011-04-13 0:36 ` moktar_bouain
2011-04-20 8:40 ` Jürgen Lambrecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DA4C51B.2070409@mlbassoc.com \
--to=gary@mlbassoc.com \
--cc=ecos-devel@ecos.sourceware.org \
--cc=moktarbouain@yahoo.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).