This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: scheduler
- To: mekala natarajan <mekala_natarajan at yahoo dot com>
- Subject: RE: [ECOS] scheduler
- From: Gary Thomas <gthomas at cambridge dot redhat dot com>
- Date: Mon, 14 May 2001 06:58:42 -0600 (MDT)
- Cc: ecos-discuss at sources dot redhat dot com
- Organization: Red Hat, Inc.
On 14-May-2001 mekala natarajan wrote:
> Hi,
> I have a doubt regarding scheduler.
>
> i have two process one with higher priority and the
> other with lower priority.
>
> This is the example program which i used.
>
>
> int main()
> {
> xCreateProcess_i(xPclcpsSender_v,5,ZERO,0);
> xCreateProcess_i(xPclcpr_v,7,ZERO,0);
>
> mProcessId_i=xGetProcessId_i();
> xKillProcess_i(mProcessId_i);
> }
>
> void xPclcpr_v(void)
> {
> while(1)
> {
> printf("\n Receiver process is created\n");
> xDelay_v(5);
> }
> }
>
> void xPclcpsSender_v(void)
> {
> while(1)
> {
> printf("\n Sender process is created\n");
> xDelay_v(3);
> }
> }
>
> Output:
> -------
> Sender process is created
> Sender process is created
> receiver process is created
> Sender process is created
> Sender process is created
> receiver process is created
> ----
> Why is this output. It is supposed to print Sender
> process only once.
>
Why do you think this should be so?
> How the scheduler behaves here?
>
I assume that xDelay_v() calls 'thread_sleep()' or some such similar
"blocking" function.
When the "receiver" process is sleeping (xDelay_v()), the "sender"
process will run, thus the printout.
> Can someone explain me?