[ECOS] Thread related queries

Jonathan Larmour jlarmour@redhat.com
Thu Sep 6 13:08:00 GMT 2001


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?

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine



More information about the Ecos-discuss mailing list