This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Thread related queries
- To: Jonathan Larmour <jlarmour at redhat dot com>
- Subject: Re: [ECOS] Thread related queries
- From: Nick Garnett <nickg at redhat dot com>
- Date: 07 Sep 2001 10:34:22 +0100
- Cc: jaiprakash at inablers dot net, ecos-discuss at sources dot redhat dot com
- References: <200108251135.RAA16753@inablers.net><3B97D7A9.1E29D21A@redhat.com>
Jonathan Larmour <jlarmour@redhat.com> writes:
> Jaiprakash wrote:
> > On linux the control goes to main() once, later the threads keep
> > running continuously. But in ecos the main() seems to get more
> > timeslice (15 - 20 times more) than the three threads. My basic clock
> > tick is 0.5 secs and timeslicing is 2 ticks. can you give me some
> > inputs regarding the difference of behaviour eventhough i am using
> > pthread calls.
>
> eCos is a real-time system (which Linux is not), which means you have to be
> concerned about the thread priorities. A higher priority thread will get
> all the CPU, unless it has been blocked for some reason. main()'s (eCos)
> priority is set with the configuration variable
> CYGNUM_POSIX_MAIN_DEFAULT_PRIORITY, and defaults to 30.
>
> Unfortunately, a POSIX thread has a default POSIX priority of 0, which
> translates to an ECOS_PRIORITY of (CYG_THREAD_MIN_PRIORITY-priority) i.e.
> 31. Not only is this less than main's, it is the same as the idle thread,
> meaning it will be timeslicing with it.
>
> I think instead sched_priority in pthread_attr_init() should default to 1.
> Nick, know any reason why not?
>
It is actually irrelevant, since the inherit attribute is set to
PTHREAD_INHERIT_SCHED the default is for all threads to inherit the
priority of their creator.
Without looking at Jaiprakash's program, it is difficult to know what
is actually happening.
--
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK