scheduler problems
- To: debian-embedded@lists.debian.org
- Subject: scheduler problems
- From: Junior <ejr@inbox.com>
- Date: Thu, 11 May 2006 05:51:41 -0800
- Message-id: <[🔎] 2D61C4CC042.000002A4ejr@inbox.com>
- In-reply-to: <200604271755.07665@zigzag.lvk.cs.msu.su>
- References: <71a0d6ff0604270152x4dd92ecawb7e06d2b7f3b6648@mail.gmail.com> <71a0d6ff0604270652h1e58eba9vada110485818196@mail.gmail.com> <2879319.fhh6a2wgrj@zigzag.lvk.cs.msu.su>
Hi All,
I have a scheduling problem I need some help on. If you can offer any advise, please help.
I started my main application which spawns two threads. These threads runs as expected (well , so far) but the main program which stays in a loop checking for various events, fails to run at the appropriate time. The sequence below shows my sequence.
main() {
inits......
if((sched_param.sched_priority = (sched_get_priority_max(SCHED_RR))) < 0) printf("Get priority max failed\n");
if(sched_setscheduler(getpid(), SCHED_RR, &sched_param)) printf("Scheduler RR FAILED %i\n",sched_param.sched_priority);
if(pthread_attr_init(&my_t_attr) != 0) printf("FAIL to init thread attr\n");
if((sched_param.sched_priority = sched_get_priority_max(SCHED_RR)) < 0) printf("Get priority max failed\n");
if(!pthread_attr_setschedparam(&my_t_attr, &sched_param)) printf("FAIL to set sched param\n");
if(pthread_create(&parser_th, &my_t_attr, m_parser, NULL) != 0) printf("parser thread FAILED\n");
if(pthread_create(&omni_th, &my_t_attr, omni_com, NULL) != 0) printf("Comm thread FAILED\n");
while(!quit) {
...
Check for events & identify if any
....
}
} // main
The main program (event checker) fails to perform its tasks in appropriate time. It may take upto 3 minutes to be executed. The other threads will block (put to sleep) for 5 to 10ms if nothing needs to be done.
can anyone please help me out here?
Thanks, in advance.
Reply to: