Thread Scheduling
|
Type
|
Level
|
UID
|
STATUS
|
TYPE
|
COMPONENT
|
REFS
|
Title
|
Statement
|
USER_STORY
|
|---|---|---|---|---|---|---|---|---|---|
|
TEXT
|
|
SPDX-License-Identifier: Apache-2.0 |
|||||||
|
SECTION
|
1 |
|
|
||||||
|
REQUIREMENT
|
1.1 |
|
|
|
|
Parents:
|
|
When an event on which a thread is waiting occurs, the Zephyr RTOS shall make the waiting thread ready. |
As a Zephyr RTOS user, I want to be able to execute work which reacts on events and interrupts the current executed work. |
|
REQUIREMENT
|
1.2 |
|
|
|
|
Parents:
|
|
Where earliest-deadline-first scheduling is enabled, when two or more ready threads have equal static priority, the Zephyr RTOS shall consider the thread with the earliest deadline to have the higher priority. |
As a Zephyr RTOS user, I want to be able to schedule threads by earliest deadline first. |
|
REQUIREMENT
|
1.3 |
|
|
|
|
Parents:
|
|
Where earliest-deadline-first scheduling is enabled, when two or more ready threads have equal static priority and equal deadlines, the Zephyr RTOS shall treat them as threads of equal priority. |
|
|
REQUIREMENT
|
1.4 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall schedule threads according to a numeric thread priority, giving a thread with a numerically lower priority value precedence over a thread with a numerically higher priority value. |
As a Zephyr RTOS user, I want the OS to schedule threads by numeric priority so that I can control the relative importance of my threads. |
|
REQUIREMENT
|
1.5 |
|
|
|
|
Parents:
|
|
While the current thread is preemptible, when a thread of higher priority becomes ready, the Zephyr RTOS shall suspend execution of the current thread and select the higher-priority thread as the current thread. |
As a Zephyr RTOS user, I want a higher priority thread to take over the CPU as soon as it becomes ready, so that important work is not delayed by less important work. |
|
REQUIREMENT
|
1.6 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall partition the thread priority space into a cooperative priority range and a preemptible priority range. |
As a Zephyr RTOS user, I want thread priorities organized into cooperative and preemptible ranges, so that a thread's priority determines its preemption behavior. |
|
REQUIREMENT
|
1.7 |
|
|
|
|
Parents:
Children:
|
|
Where time slicing is enabled, the Zephyr RTOS shall cause the current preemptible thread to relinquish the CPU after not more than a configurable time slice period whenever one or more other ready threads of the same priority exist. |
As a Zephyr RTOS user, I want to be able to configure my RTOS in the way, that the CPU resources are shared evenly among executed threads of the same priority. |
|
REQUIREMENT
|
1.8 |
|
|
|
|
|
When a scheduling decision is made on a CPU, the Zephyr RTOS shall select as the current thread the highest-priority ready thread that is eligible to execute on that CPU. |
|
|
|
REQUIREMENT
|
1.9 |
|
|
|
|
Parents:
|
|
When two or more ready threads share the same priority, the Zephyr RTOS shall select among them the thread that has been ready the longest. |
|
|
REQUIREMENT
|
1.10 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall support cooperative threads that, once running, are not subject to preemption by other threads and remain the current thread until they yield or block. |
|
|
REQUIREMENT
|
1.11 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall provide an interface for the current thread to voluntarily relinquish the CPU to other ready threads of the same or higher priority. If no ready thread of the same or higher priority exists, the current thread shall continue to execute. |
|
|
REQUIREMENT
|
1.12 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall provide interfaces for a preemptible thread to disable preemption of itself by other threads and to subsequently restore its preemptible status. |
|
|
REQUIREMENT
|
1.13 |
|
|
|
|
Parents:
|
|
While a thread has disabled preemption, when that thread becomes unready, the Zephyr RTOS shall allow other threads to execute. |
|
|
REQUIREMENT
|
1.14 |
|
|
|
|
Parents:
|
|
When a thread that has disabled preemption resumes execution after having been unready, the Zephyr RTOS shall continue to treat the thread as non-preemptible until it re-enables preemption. |
|
|
REQUIREMENT
|
1.15 |
|
|
|
|
Parents:
|
|
Where earliest-deadline-first scheduling is enabled, the Zephyr RTOS shall provide an interface to set a thread's deadline. |
|
|
REQUIREMENT
|
1.16 |
|
|
|
|
Parents:
|
|
Where per-thread time slicing is enabled, the Zephyr RTOS shall provide an interface to set an individual time slice duration and expiry callback for a specific thread. |
|
|
REQUIREMENT
|
1.17 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall provide an interface to request an immediate re-evaluation of the scheduling decision on the current CPU in accordance with the scheduling rules. |
|
|
REQUIREMENT
|
1.18 |
|
|
|
|
Parents:
|
|
When a re-evaluation of the scheduling decision is requested from an interrupt service routine, the Zephyr RTOS shall perform the re-evaluation upon exit from the interrupt. |
|
|
REQUIREMENT
|
1.19 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall provide an interface to determine whether the currently executing context can be preempted by another thread. |
|
|
REQUIREMENT
|
1.20 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall support selecting the scheduler's ready queue implementation at build time. |
As a Zephyr RTOS user, I want to choose a ready queue implementation that matches my system's memory, code size, and ready-thread-count profile, so that scheduling overhead fits my application. |
|
REQUIREMENT
|
1.21 |
|
|
|
|
Parents:
|
|
Where deferred interrupt processing threads are configured, the Zephyr RTOS shall reserve the highest thread priorities for them. |
|
|
REQUIREMENT
|
1.22 |
|
|
|
|
Parents:
|
|
Where deferred interrupt processing threads are configured, when a deferred interrupt processing thread becomes ready, the Zephyr RTOS shall preempt the current thread, even if it is cooperative or has disabled preemption, and select the ready thread as the current thread, when either of the following conditions is satisfied:
|
|
|
REQUIREMENT
|
1.23 |
|
|
|
|
Parents:
|
|
Where deferred interrupt processing threads are configured, a running deferred interrupt processing thread shall remain interruptible by interrupt service routines. |
|
|
REQUIREMENT
|
1.24 |
|
|
|
|
|
Where time slicing is enabled, the Zephyr RTOS shall exempt threads whose priority is higher than a configurable priority threshold from time slicing. |
|