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: How does multi-threading happen?


HuangQiang wrote:
> 
> Hi all:
>     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
> thread. But if for two equal priority thread how does the thread switching
> happens? How does the thread know when to switch to another thread if the
> other is the same priority?  where does the scheduler take care of the
> thread switching(equal priority threads)? (arm e7t)
> 
> Thanks a lot for your help.

It happens either when the running thread blocks, or a clock interrupt is
received and the kernel decides a timeslice needs to happen. In either
case, what happens is that the scheduler will have been locked by e.g. a
mutex or semaphore, or for a timeslice by the interrupt code, and then the
rescheduling happens in the code that unlocks the scheduler.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine

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