Re: Cobalt scheduler preemption behavior
Jan Kiszka <[email protected]>
| Newsgroups | dev.linux.lists.xenomai |
|---|---|
| Message-ID | <[email protected]> |
On 08.08.26 08:17, C Smith wrote: > I am using Xenomai 3.1, Cobalt kernel 4.19.229 X8664 (I know it's old > but this is a legacy system our company still develops). I am > wondering about expected Cobalt scheduler behavior on a single core. I > have set isolcpus to reserve core 1, my first real time task sets > affinity to core 1, the priority is 99. > > ret = rt_task_create(&main_task, "my_rt_task", 0, 99, T_JOINABLE); > CPU_ZERO(&cpus); > CPU_SET(1, &cpus); > rt_task_set_affinity(&main_task, &cpus) > > Then I do the same with a second RT task, giving it the same priority > (99) and same CPU core 1 affinity. > > First Question: If the first RT task is executing, and the second RT > task wakes up from a sleep, can I expect the scheduler to preempt the > first RT task to run the second RT task on that same CPU core? Same prio and SCHED_FIFO (used when prio > 0) means that the first task runs until completion (exit, self-suspend, blocked on wait-condition) before the second in that FIFO queue for the same prio level is run. > > I put DIO pulses around both tasks and the oscilloscope says 'yes', > the second task preempts the first. I'm a bit confused about that, as > I expected FIFO non-preemptable behavior from the Cobalt kernel. ie: > I thought the first task would finish, then the second task would run. > > Second question: Is there a way to configure the Cobalt kernel, or my > two RT tasks, such that they can't preempt one another, but when there > is contention the first to run is allowed to finish before the second > runs? > To achieve preemption, you need different prio levels or some time-slicing configuration (rt_task_slice). Jan -- Siemens AG, Foundational Technologies Linux Expert Center