This is the mail archive of the
ecos-discuss@sourceware.cygnus.com
mailing list for the eCos project.
Re: about timeslice and same priority thread switch.
- To: yyl <ylyuan at csrd dot org>
- Subject: Re: [ECOS] about timeslice and same priority thread switch.
- From: Jonathan Larmour <jlarmour at redhat dot co dot uk>
- Date: Tue, 30 May 2000 22:47:03 +0100
- CC: ecos <ecos-discuss at sourceware dot cygnus dot com>
- Organization: Red Hat UK Ltd.
- References: <002001bfc9d5$a9f843a0$2901a8c0@21>
> yyl wrote:
>
> Hi, after finished building the ecos1.3.1 on Redhat linux6.1(target is pc
> x86),I use gdb stub and the example twothreads.c to test.
> From the document and the code of kernel,I think the threads of same
> priority should switch by timeslice.But after comment the sentence in
> twothreads.c as followed:
> cyg_thread_delay(200);
> I find no switch.Who can tell me why?
So you are saying that by changing the code to the following, it stops
working?
printf("Beginning execution; thread data is %d\n", message);
/* cyg_thread_delay(200); */
for (;;) {
delay = 200 + (rand() % 50);
/* note: printf() must be protected by a
call to cyg_mutex_lock() */
cyg_mutex_lock(&cliblock); {
printf("Thread %d: and now a delay of %d clock ticks\n",
message, delay);
}
cyg_mutex_unlock(&cliblock);
cyg_thread_delay(delay);
}
Are you sure you didn't change anything in your configuration from the
default that you didn't mean to?
> I think the switch of thread
> invoked by dsr of real time clock interrupt.Is that right?
Yes. See Cyg_RealTimeClock::dsr() in kernel/VERSION/src/common/clock.cxx
Jifl
--
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow." || These opinions are all my own fault