[ECOS] Help: non pre-emptive kernel with priorities

Zhao Luo ZhaoL@TCTechnologies.tc
Tue Mar 1 15:14:00 GMT 2005


Thanks Andrew, I will test it out and see how it is going on. So I
assume there is not priority boost in the MLQ scheduler, either?

Zhao

-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch] 
Sent: Friday, February 25, 2005 3:57 PM
To: Zhao Luo
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Help: non pre-emptive kernel with priorities

On Thu, Feb 24, 2005 at 05:48:51PM +0100, Zhao Luo wrote:
> Hi, All, 
> 
> I want to use a non-preemptive kernel with priorities. That is, during
a
> thread's running, even when a higher priority thread gets ready, the
> higher priority thread still needs to wait until the current thread
> yield/block. Is this possible with eCos? I read the reference manual;
it
> says the higher priority thread can AUTOMATICALLY preempt the low
> priority threads. 
> So my question is: 
> 1. Is there anything I can configure/hack in MLQ to change this
> behavior?

eCos does not have this behavour. 

Its a hack, but i would try something like the following. I've not
tested this at all and since the schedular was not designed to support
this don't be supprised if it does not work, or causes deadlocks etc.

        Andrew


Index: kernel/current/src/sched/sched.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/src/sched/sched.cxx,v
retrieving revision 1.16
diff -u -r1.16 sched.cxx
--- kernel/current/src/sched/sched.cxx  9 Aug 2002 17:13:28 -0000
1.16
+++ kernel/current/src/sched/sched.cxx  25 Feb 2005 20:55:12 -0000
@@ -177,7 +177,7 @@
         // If the current thread is going to sleep, or someone
         // wants a reschedule, choose another thread to run

-        if( current->state != Cyg_Thread::RUNNING ||
get_need_reschedule() ) {
+        if( current->state != Cyg_Thread::RUNNING ) {

             CYG_INSTRUMENT_SCHED(RESCHEDULE,0,0);





--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list