This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]