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: [Fwd: RE: Question about Kernel? (Scheduler)]


Hi james,

I think the answer to your question depends on the scheduler policy you
choose. If you use a scheduler with time-slicing enabled, then threads
of equal priority will be switched round robin as the result of a
periodic
clock interrupt. However, threads with a lower priority will never be
run
unless the infinite loop blocks for I/O or waits on a timer at some
point.

IMHO, infinite loops that do not block are a bad design choice that
generally
wastes processor bandwidth. If you *must* poll something in a loop (e.g.
because the %&$^#* hardware guy didn't give you an interrupt), then the
the thread should wait on a timer each time through the loop.

mike

Jesper Skov wrote:
> 
>   ------------------------------------------------------------------------
> 
> Subject: RE: [ECOS] Question about Kernel? (Scheduler)
> Date: Thu, 25 Apr 2002 10:05:00 +0100
> From: "HuangQiang" <jameshq@liverpool.ac.uk>
> To: "Jesper Skov" <jskov@redhat.com>
> 
> Hi jesper:
>    Thanks for your reply. And could I ask you one more question about the
> kernel handling the multi-threading?
> 
> In eCOS after a thread is created and resume, the actual user's program will
> be run by calling hal_thread_load_context() and branch to the user's code.
> But if for two equal priority thread exist how does the thread switching
> happens? How does the thread know when to switch to another thread if the
> other is the same priority(for a user application it is always a infinite
> loop)?  where does the scheduler take care of the thread switching(equal
> priority threads)? (Is there any interrrupt used for this mechanism?)
> 
> Thanks a lot for your help.
> 
> james
> 

-- 
Michael N. Moran           (h) 770 516 7918
5009 Old Field Ct.         (c) 678 521 5460
Kennesaw, GA 30144         http://personal.bellsouth.net/~mnmoran

The Beatles were wrong: 1 & 1 & 1 is 1

-- 
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]