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]

[Fwd: RE: Question about Kernel? (Scheduler)]




--- Begin Message ---
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

-----Original Message-----
From: Jesper Skov [mailto:jskov@redhat.com]
Sent: 25 April 2002 07:36
To: HuangQiang
Cc: eCos Discuss
Subject: Re: [ECOS] Question about Kernel? (Scheduler)


On Tue, 2002-04-23 at 18:11, HuangQiang wrote:
> Hi all:
>     I have got a problem in understanding the kernel of eCOS.
> While creating a user thread(cyg_thread_create()) an CYG_Thread class
object
> pinter will be constructed, and in the object constructor it will call
> CYG_Scheduler::scheduler.register_thread(). The question: isn't an object
of
> the CYG_Scheduler needed to be created? Also in the declaration of
> CYG_Scheduler, an member variable scheduler type of CYG_Scheduler(In other
> C++ program(like Visual C++) such definition can't be used at link time
> while it can't find the symbol why?). So isn't an object of CYG_Scheduler
> needed? why implement it in such
> way(CYG_Scheduler::scheduler.register_thread())? Why don't create an
object
> of the CYG_Scheduler?  I don't understand why this is done in such way.
> Could anybody give me some suggestion on it?

At a guess, CYG_Scheduler::scheduler is a static instantiation of the
scheduler. There's only need for one scheduler in the system, so each
thread should obviously not create one.

Jesper


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