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.
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");
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.