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]

Re: Thread related queries


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]