This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: How does multi-threading happen?
- From: Jonathan Larmour <jlarmour at redhat dot com>
- To: HuangQiang <jameshq at liverpool dot ac dot uk>
- Cc: eCos <ecos-discuss at sources dot redhat dot com>
- Date: Tue, 14 May 2002 20:57:35 +0100
- Subject: Re: [ECOS] How does multi-threading happen?
- Organization: Red Hat UK Ltd.
- References: <KIEBICHBADHFCLGCKOPDIEOJCLAA.jameshq@liv.ac.uk>
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