[ECOS] Preemptive Scheduling in Multilevel Queue Scheduler

Michael Gorlick gorlick@aero.org
Thu Dec 10 13:48:00 GMT 1998

Will someone please straighten me out? After staring at the eCos source code
it just isn't clear to me how preemptive (timesliced) scheduling actually
works in
the multilevel queue scheduler (mlqueue).

The expiration of a timeslice results in a DSR being posted on the DSR
queue and that
DSR, when executed, forces the current thread to relinquish the processor
(by invoking
"yield()" on the current thread).  However (and this is where my confusion
arises) DSRs
are executed when, and only when, the scheduler lock is about to transition
from 1
to 0.  Consequently, if a thread running under the multilevel queue
discipline NEVER
directly or indirectly invokes the scheduler "unlock()" method  no DSRs
will ever be
executed and the thread will never be forced to yield the processor
irrespective of the
number of timeslices periods that have passed.  Is this correct and if not
where should
I look in the source code to correct my misunderstanding?

The same problem exists for DSRs in general since "unlock_inner" is the only
component (as far as I can determine) that calls and executes the posted DSRs.
Again, how do device drivers and interrupts get their DSRs executed in a
timely manner
if their execution can be delayed indefinitely by a thread that, for
whatever reason,
never acquires or releases the scheduler lock?

Thank you in advance for taking the time to answer my question.

... /o-----o>

More information about the Ecos-discuss mailing list