Periodic scheduling of 2 kernel tasks (different modules)
bhargavb <[email protected]> Mon, 8 May 2017 21:21:23 +0530
| Newsgroups | gmane.linux.real-time.rtai |
|---|---|
| Message-ID | <CA+bpL9+fGhQsbxCdLH0CmXg5PDnFqqBjKaE-bZSszkMb6dBJ=Q@mail.gmail.com> |
Hello, I am a beginner in rtai (and kernel module programming). Kindly answer below queries. *Question 1:* I have written 2 simple rtai kernel modules using periodic scheduling, both of them. One module prints one number each period (starting from 1 to 10 incrementing each period) and other one does the same thing -1 to -10 decrementing each period. There are no other rtai kernel modules that I have inserted except the two (apart from rtai hal,sched etc). In this scenario, where no other real time modules are inserted by me, shouldn't the behaviour be consistent? It is not happening so. If in a cycle it prints 1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,7,-7,8,-8,9,-9,10,-10 in other cycle of execution (I do rmmod and insmod again), it prints some other pattern like 1,2,3,4,-1,-2,5,6, etc As long as same logic is present in each rtai kernel modules and no new rtai kernel module inserted or deleted, the output should be same each execution in real time. But it is not so. I did not get this. Please help me understand. *Question 2:* I have seen in some of the example code samples, *rt_set_oneshot_mode()* is called and then *start_rt_timer(1)*, then *rt_task_init()* and *rt_task_make_periodic()* . Does one shot mode setting of the timer have any effect in the sequence of calls? I understand the timer can be either set to one shot mode or periodic mode. I understand we are setting one shot mode initially and then overriding the setting by calling *rt_task_make_periodic()*. Is my understanding correct? I mean it is same as removing the call to rt_set_oneshot_mode() --- --- --- * rt_set_oneshot_mode(); timer_period_count=nano2count(timer_period_ns); start_rt_timer(timer_period_count); rt_task_init_cpuid(&tau_2, /* pointer to our task structure */ f_tau_2, /* the task function */ 0, /* arg for f_tau_2 */ 1024, /* size of the stack */ 100, /* tau_2 has priority = 100 */ 0, /* we don't use floating point unit */ 0, /* we don't use signals */ 0); /* run on CPU 0 */ rt_task_make_periodic(&tau_1, /* pointer to our task structure */ /* start 2 timer_periods from now */ rt_get_time() + 2*timer_period_count, 5*timer_period_count); /* recurring period (ignored in one-shot) */* --- --- --- Thanks and regards, Bhargav _______________________________________________ Rtai mailing list [email protected] https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai