From 0153b7dc50428fc85e8717a09b75ef0fc0436089 Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Wed, 29 Sep 2021 15:51:05 -0400 Subject: [PATCH] doc: Add deadline scheduling information Adds information to the kernel scheduling documentation explaining how a thread's deadline is used to determine the thread's relative priority. Signed-off-by: Peter Mitsis --- doc/reference/kernel/scheduling/index.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/reference/kernel/scheduling/index.rst b/doc/reference/kernel/scheduling/index.rst index 7032d404553..20a65bdd6f2 100644 --- a/doc/reference/kernel/scheduling/index.rst +++ b/doc/reference/kernel/scheduling/index.rst @@ -39,6 +39,15 @@ The kernel's scheduler selects the highest priority ready thread to be the current thread. When multiple ready threads of the same priority exist, the scheduler chooses the one that has been waiting longest. +A thread's relative priority is primarily determined by its static priority. +However, when both earliest-deadline-first scheduling is enabled +(:kconfig:`CONFIG_SCHED_DEADLINE`) and a choice of threads have equal +static priority, then the thread with the earlier deadline is considered +to have the higher priority. Thus, when earliest-deadline-first scheduling is +enabled, two threads are only considered to have the same priority when both +their static priorities and deadlines are equal. The routine +:c:func:`k_thread_deadline_set` is used to set a thread's deadline. + .. note:: Execution of ISRs takes precedence over thread execution, so the execution of the current thread may be replaced by an ISR