Reputation: 195
Can someone help me understand with clear explantion or any reference link, How kernel handles preemption on tasks having same priority. Suppose i have three TASKS A, B and C assigned with High priority
TASK(A) { High Priority Reading Asynchronous messages }
TASK(B) { High Priority Sending Asynchronous messages }
TASK(C) { High Priority Draw process }
In this case which Task will be considered for processing and how is it preempted?
Upvotes: 0
Views: 1215
Reputation: 3768
General scheduling order is
schedule()
either directly in kernel context or when TIF_NEED_RESCHED
flag is set and kernel returning from interrupt context.pick_next_task()
to receive the task, which will preempt currently running one.pick_next_task()
invokes every scheduler class' pick_next_task()
in order of descending priority until one of them returns task. Note, that priority means class' priority (e.g. soft real-time or normal), not process' one.For scheduler, there is no matter what process are doing, what massages it sends or receives. So, in general case, if your processes have equal priorities, process with less run-time will preempt another process on the next schedule()
invokation.
Upvotes: 2