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: Question about scheduler & sleep


>>>>> "Jim" == jyl087  <jyl087@netscape.net> writes:

    Jim> Thanks for the thoughtful answer! From your reply, I think I
    Jim> can infer something else which I've been curious about...
    Jim> namely, what is the difference between cyg_scheduler_lock()
    Jim> and disabling interrupts.

    Jim> It sounds like cyg_scheduler_lock() allows ISRs to run, but
    Jim> DSRs will not get scheduled. Is that right?

Essentially correct. While the scheduler lock count > 0 the system
will not run any DSRs, nor will there be a context switch from the
current thread to another - even if there are higher-priority runnable
threads, or if the current thread is no longer runnable. However ISRs
are still allowed to run.

The net effect is that locking the scheduler has no effect on
interrupt latency, i.e. the time from the hardware interrupt to the
ISR being run and servicing the hardware. It does affect dispatch
latency, i.e. the time from a hardware interrupt to a high-priority
thread running again as a consequence of that interrupt. Interrupt
latency is generally much more critical than dispatch latency.
Therefore executing say a couple of dozen instructions with the
scheduler locked is much less harmful than doing so with interrupts
disabled. However it is still undesirable to keep the scheduler locked
any longer than absolutely necessary.

Bart

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


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