From 302c2fdfbcd72d587632ca978db0bcb13d5badc6 Mon Sep 17 00:00:00 2001 From: Joel Key Date: Fri, 14 Mar 2025 10:22:25 -0400 Subject: [PATCH 1/5] software: Initial Perplexity Reqts --- docs/software_requirements/index.sdoc | 3 + docs/software_requirements/scheduling.sdoc | 212 +++++++++++++++++++++ 2 files changed, 215 insertions(+) create mode 100644 docs/software_requirements/scheduling.sdoc diff --git a/docs/software_requirements/index.sdoc b/docs/software_requirements/index.sdoc index a39b6662..ba7c7dfd 100644 --- a/docs/software_requirements/index.sdoc +++ b/docs/software_requirements/index.sdoc @@ -69,3 +69,6 @@ FILE: tracing.sdoc [DOCUMENT_FROM_FILE] FILE: condition_variables.sdoc + +[DOCUMENT_FROM_FILE] +FILE: scheduling.sdoc diff --git a/docs/software_requirements/scheduling.sdoc b/docs/software_requirements/scheduling.sdoc new file mode 100644 index 00000000..09f01099 --- /dev/null +++ b/docs/software_requirements/scheduling.sdoc @@ -0,0 +1,212 @@ +[DOCUMENT] +TITLE: Scheduling +REQ_PREFIX: ZEP-SRS-23- + +[GRAMMAR] +IMPORT_FROM_FILE: software_requirements.sgra + +[TEXT] +STATEMENT: >>> +SPDX-License-Identifier: Apache-2.0 +<<< + +[SECTION] +TITLE: Thread Scheduling Algorithm + +[REQUIREMENT] +UID: ZEP-SRS-23-001 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Priority-Based Selection +STATEMENT: >>> +The scheduler shall select the highest priority ready thread as the current thread from the ready queue. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-23-002 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Deadline Enforcement (EDF) +STATEMENT: >>> +When EDF scheduling is enabled, the system shall prioritize threads with equal static priority based on earliest deadline. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-23-003 +STATUS: Active +TYPE: Non-Functional +COMPONENT: Scheduling +TITLE: Ready Queue Scalability +STATEMENT: >>> +The scheduler shall support configurable ready queue implementations (DUMB/RBTREE/MULTIQ) with O(1) or O(log n) time complexity as documented. +<<< + +[/SECTION] + +[SECTION] +TITLE: Rescheduling Points + +[REQUIREMENT] +UID: ZEP-SRS-23-004 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Mandatory Context Switch Triggers +STATEMENT: >>> +The system shall trigger rescheduling during: thread state transitions (→SUSPENDED/WAITING), ISR returns, explicit k_yield() calls, and time slice expiration. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-23-005 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Atomic Rescheduling +STATEMENT: >>> +Rescheduling shall occur atomically at designated points to prevent partial state corruption during thread swaps. +<<< + +[/SECTION] + +[SECTION] +TITLE: Thread States and Priorities + +[REQUIREMENT] +UID: ZEP-SRS-23-006 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Cooperative Thread Non-Preemption +STATEMENT: >>> +Cooperative threads (negative priority) shall retain execution until explicitly yielding or entering unready state. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-23-007 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Preemptive Thread Interruption +STATEMENT: >>> +Preemptive threads (≥0 priority) shall be interrupted immediately by higher-priority ready threads. +<<< + +[/SECTION] + +[SECTION] +TITLE: Time Slicing + +[REQUIREMENT] +UID: ZEP-SRS-23-008 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Cooperative Voluntary Yielding +STATEMENT: >>> +Cooperative threads invoking k_yield() shall allow equal/higher priority threads to execute before resuming. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-23-009 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Preemptive Time Quantum +STATEMENT: >>> +Preemptive threads shall relinquish CPU after a configurable time slice (system ticks) if equal-priority threads are ready. +<<< + +[/SECTION] + +[SECTION] +TITLE: Scheduler Locking + +[REQUIREMENT] +UID: ZEP-SRS-23-010 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Non-Preemptible Critical Sections +STATEMENT: >>> +k_sched_lock() shall treat preemptive threads as cooperative until k_sched_unlock(). +<<< + +[/SECTION] + +[SECTION] +TITLE: Thread Management + +[REQUIREMENT] +UID: ZEP-SRS-23-011 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Sleep Duration Accuracy +STATEMENT: >>> +k_sleep() shall delay thread execution within ±1 tick of requested duration. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-23-012 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Busy Wait Non-Relinquishing +STATEMENT: >>> +k_busy_wait() shall not yield CPU or trigger rescheduling during delay. +<<< + +[/SECTION] + +[SECTION] +TITLE: SMP Considerations + +[REQUIREMENT] +UID: ZEP-SRS-23-013 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Affinity Awareness +STATEMENT: >>> +The scheduler shall honor thread-CPU affinity masks in SMP configurations. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-23-014 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Cross-CPU Atomicity +STATEMENT: >>> +Spinlocks shall enforce cross-CPU mutual exclusion for scheduler data structures. +<<< + +[/SECTION] + +[SECTION] +TITLE: Safety and Compliance + +[REQUIREMENT] +UID: ZEP-SRS-23-015 +STATUS: Active +TYPE: Non-Functional +COMPONENT: Scheduling +TITLE: MISRA-C:2012 Adherence +STATEMENT: >>> +All scheduler code shall comply with MISRA-C:2012 guidelines with documented deviations. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-23-016 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Deterministic Latency +STATEMENT: >>> +Worst-case context switch latency shall be ≤X μs (platform-specific). +<<< + +[/SECTION] + From af0e49a9ca26dd37b9204e2444fed00f03a74669 Mon Sep 17 00:00:00 2001 From: Joel Key Date: Fri, 14 Mar 2025 10:23:29 -0400 Subject: [PATCH 2/5] Include System Reqts --- docs/system_requirements/index.sdoc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/system_requirements/index.sdoc b/docs/system_requirements/index.sdoc index a73ccdaf..fbab8382 100644 --- a/docs/system_requirements/index.sdoc +++ b/docs/system_requirements/index.sdoc @@ -308,3 +308,18 @@ The Zephyr RTOS shall provide a framework to synchronize threads based on a cond <<< [/SECTION] + +[SECTION] +TITLE: Scheduling + +[REQUIREMENT] +UID: ZEP-SYRS-23 +STATUS: Draft +TYPE: Functional +COMPONENT: Scheduling +TITLE: Scheduling +STATEMENT: >>> +The Zephyr RTOS shall provide a framework to allow an application's threads to share the CPU. +<<< + +[/SECTION] From 2fc327bc336bb4a45b8a9146df1122be7fb55265 Mon Sep 17 00:00:00 2001 From: Joel Key Date: Fri, 14 Mar 2025 17:35:15 -0400 Subject: [PATCH 3/5] software: Review docs & Update generated requirements --- docs/software_requirements/scheduling.sdoc | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/software_requirements/scheduling.sdoc b/docs/software_requirements/scheduling.sdoc index 09f01099..28e03a9f 100644 --- a/docs/software_requirements/scheduling.sdoc +++ b/docs/software_requirements/scheduling.sdoc @@ -30,7 +30,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Deadline Enforcement (EDF) STATEMENT: >>> -When EDF scheduling is enabled, the system shall prioritize threads with equal static priority based on earliest deadline. +When earliest-deadline-first (EDF) scheduling is enabled, the scheduler shall prioritize threads with equal static priority based on earliest deadline. <<< [REQUIREMENT] @@ -40,13 +40,13 @@ TYPE: Non-Functional COMPONENT: Scheduling TITLE: Ready Queue Scalability STATEMENT: >>> -The scheduler shall support configurable ready queue implementations (DUMB/RBTREE/MULTIQ) with O(1) or O(log n) time complexity as documented. +The scheduler shall support configurable ready queue implementations. <<< [/SECTION] [SECTION] -TITLE: Rescheduling Points +TITLE: Reschedule Points [REQUIREMENT] UID: ZEP-SRS-23-004 @@ -55,7 +55,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Mandatory Context Switch Triggers STATEMENT: >>> -The system shall trigger rescheduling during: thread state transitions (→SUSPENDED/WAITING), ISR returns, explicit k_yield() calls, and time slice expiration. +The scheduler shall trigger rescheduling during: thread state transitions (→SUSPENDED/WAITING), ISR returns, explicit k_yield() calls, and time slice expiration. <<< [REQUIREMENT] @@ -65,7 +65,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Atomic Rescheduling STATEMENT: >>> -Rescheduling shall occur atomically at designated points to prevent partial state corruption during thread swaps. +The scheduler shall perform rescheduling atomically at designated points to prevent partial state corruption during thread swaps. <<< [/SECTION] @@ -80,7 +80,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Cooperative Thread Non-Preemption STATEMENT: >>> -Cooperative threads (negative priority) shall retain execution until explicitly yielding or entering unready state. +The scheduler shall ensure Cooperative threads (negative priority) retain execution until explicitly yielding or entering unready state. <<< [REQUIREMENT] @@ -90,7 +90,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Preemptive Thread Interruption STATEMENT: >>> -Preemptive threads (≥0 priority) shall be interrupted immediately by higher-priority ready threads. +The scheduler shall allow Preemptive threads (≥0 priority) to be interrupted immediately by higher-priority ready threads. <<< [/SECTION] @@ -105,7 +105,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Cooperative Voluntary Yielding STATEMENT: >>> -Cooperative threads invoking k_yield() shall allow equal/higher priority threads to execute before resuming. +The scheduler shall provide a mechanism for Cooperative threads to allow equal/higher priority threads to execute before resuming. <<< [REQUIREMENT] @@ -115,7 +115,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Preemptive Time Quantum STATEMENT: >>> -Preemptive threads shall relinquish CPU after a configurable time slice (system ticks) if equal-priority threads are ready. +The scheduler shall ensure Preemptive threads relinquish CPU after a configurable time slice (system ticks) if equal-priority threads are ready. <<< [/SECTION] @@ -130,7 +130,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Non-Preemptible Critical Sections STATEMENT: >>> -k_sched_lock() shall treat preemptive threads as cooperative until k_sched_unlock(). +The scheduler shall provide a mechanism to treat preemptive threads as cooperative until a unlock function is called. <<< [/SECTION] @@ -143,9 +143,19 @@ UID: ZEP-SRS-23-011 STATUS: Active TYPE: Functional COMPONENT: Scheduling -TITLE: Sleep Duration Accuracy +TITLE: Thread Sleeping STATEMENT: >>> -k_sleep() shall delay thread execution within ±1 tick of requested duration. +The scheduler shall provide a mechanism to delay thread execution within ±1 tick of requested duration. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-23-011 +STATUS: Active +TYPE: Functional +COMPONENT: Scheduling +TITLE: Thread Waking +STATEMENT: >>> +The scheduler shall provide a mechanism to for a thread to wake another thread. Note: A wakeup can be attempted on a thread that is already awake - this has no effect. <<< [REQUIREMENT] @@ -155,7 +165,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Busy Wait Non-Relinquishing STATEMENT: >>> -k_busy_wait() shall not yield CPU or trigger rescheduling during delay. +The scheduler shall provide a mechanism to perform a busy wait where the scheduler will not yield CPU or trigger rescheduling during delay. <<< [/SECTION] @@ -180,7 +190,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Cross-CPU Atomicity STATEMENT: >>> -Spinlocks shall enforce cross-CPU mutual exclusion for scheduler data structures. +The scheduler shall ensure that Spinlocks enforce cross-CPU mutual exclusion for scheduler data structures. <<< [/SECTION] @@ -191,16 +201,6 @@ TITLE: Safety and Compliance [REQUIREMENT] UID: ZEP-SRS-23-015 STATUS: Active -TYPE: Non-Functional -COMPONENT: Scheduling -TITLE: MISRA-C:2012 Adherence -STATEMENT: >>> -All scheduler code shall comply with MISRA-C:2012 guidelines with documented deviations. -<<< - -[REQUIREMENT] -UID: ZEP-SRS-23-016 -STATUS: Active TYPE: Functional COMPONENT: Scheduling TITLE: Deterministic Latency From 3acbbdbd8f01b2a1e4f37f0990b47cb6d65be38c Mon Sep 17 00:00:00 2001 From: Joel Key Date: Thu, 3 Apr 2025 19:30:13 -0400 Subject: [PATCH 4/5] Scheduling: Change Subject to Zephyr RTOS --- docs/software_requirements/scheduling.sdoc | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/software_requirements/scheduling.sdoc b/docs/software_requirements/scheduling.sdoc index 28e03a9f..f764ac68 100644 --- a/docs/software_requirements/scheduling.sdoc +++ b/docs/software_requirements/scheduling.sdoc @@ -20,7 +20,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Priority-Based Selection STATEMENT: >>> -The scheduler shall select the highest priority ready thread as the current thread from the ready queue. +The Zephyr RTOS shall select the highest priority ready thread as the current thread from the ready queue. <<< [REQUIREMENT] @@ -30,7 +30,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Deadline Enforcement (EDF) STATEMENT: >>> -When earliest-deadline-first (EDF) scheduling is enabled, the scheduler shall prioritize threads with equal static priority based on earliest deadline. +When earliest-deadline-first (EDF) scheduling is enabled, the Zephyr RTOS shall prioritize threads with equal static priority based on earliest deadline. <<< [REQUIREMENT] @@ -40,7 +40,7 @@ TYPE: Non-Functional COMPONENT: Scheduling TITLE: Ready Queue Scalability STATEMENT: >>> -The scheduler shall support configurable ready queue implementations. +The Zephyr RTOS shall support configurable ready queue implementations. <<< [/SECTION] @@ -55,7 +55,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Mandatory Context Switch Triggers STATEMENT: >>> -The scheduler shall trigger rescheduling during: thread state transitions (→SUSPENDED/WAITING), ISR returns, explicit k_yield() calls, and time slice expiration. +The Zephyr RTOS shall trigger rescheduling during: thread state transitions (→SUSPENDED/WAITING), ISR returns, explicit k_yield() calls, and time slice expiration. <<< [REQUIREMENT] @@ -65,7 +65,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Atomic Rescheduling STATEMENT: >>> -The scheduler shall perform rescheduling atomically at designated points to prevent partial state corruption during thread swaps. +The Zephyr RTOS shall perform rescheduling atomically at designated points to prevent partial state corruption during thread swaps. <<< [/SECTION] @@ -80,7 +80,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Cooperative Thread Non-Preemption STATEMENT: >>> -The scheduler shall ensure Cooperative threads (negative priority) retain execution until explicitly yielding or entering unready state. +The Zephyr RTOS shall ensure Cooperative threads (negative priority) retain execution until explicitly yielding or entering unready state. <<< [REQUIREMENT] @@ -90,7 +90,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Preemptive Thread Interruption STATEMENT: >>> -The scheduler shall allow Preemptive threads (≥0 priority) to be interrupted immediately by higher-priority ready threads. +The Zephyr RTOS shall allow Preemptive threads (≥0 priority) to be interrupted immediately by higher-priority ready threads. <<< [/SECTION] @@ -105,7 +105,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Cooperative Voluntary Yielding STATEMENT: >>> -The scheduler shall provide a mechanism for Cooperative threads to allow equal/higher priority threads to execute before resuming. +The Zephyr RTOS shall provide a mechanism for Cooperative threads to allow equal/higher priority threads to execute before resuming. <<< [REQUIREMENT] @@ -115,13 +115,13 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Preemptive Time Quantum STATEMENT: >>> -The scheduler shall ensure Preemptive threads relinquish CPU after a configurable time slice (system ticks) if equal-priority threads are ready. +The Zephyr RTOS shall ensure Preemptive threads relinquish CPU after a configurable time slice (system ticks) if equal-priority threads are ready. <<< [/SECTION] [SECTION] -TITLE: Scheduler Locking +TITLE: Zephyr RTOS Locking [REQUIREMENT] UID: ZEP-SRS-23-010 @@ -130,7 +130,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Non-Preemptible Critical Sections STATEMENT: >>> -The scheduler shall provide a mechanism to treat preemptive threads as cooperative until a unlock function is called. +The Zephyr RTOS shall provide a mechanism to treat preemptive threads as cooperative until a unlock function is called. <<< [/SECTION] @@ -145,7 +145,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Thread Sleeping STATEMENT: >>> -The scheduler shall provide a mechanism to delay thread execution within ±1 tick of requested duration. +The Zephyr RTOS shall provide a mechanism to delay thread execution within ±1 tick of requested duration. <<< [REQUIREMENT] @@ -155,7 +155,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Thread Waking STATEMENT: >>> -The scheduler shall provide a mechanism to for a thread to wake another thread. Note: A wakeup can be attempted on a thread that is already awake - this has no effect. +The Zephyr RTOS shall provide a mechanism to for a thread to wake another thread. Note: A wakeup can be attempted on a thread that is already awake - this has no effect. <<< [REQUIREMENT] @@ -165,7 +165,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Busy Wait Non-Relinquishing STATEMENT: >>> -The scheduler shall provide a mechanism to perform a busy wait where the scheduler will not yield CPU or trigger rescheduling during delay. +The Zephyr RTOS shall provide a mechanism to perform a busy wait where the Zephyr RTOS will not yield CPU or trigger rescheduling during delay. <<< [/SECTION] @@ -180,7 +180,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Affinity Awareness STATEMENT: >>> -The scheduler shall honor thread-CPU affinity masks in SMP configurations. +The Zephyr RTOS shall honor thread-CPU affinity masks in SMP configurations. <<< [REQUIREMENT] @@ -190,7 +190,7 @@ TYPE: Functional COMPONENT: Scheduling TITLE: Cross-CPU Atomicity STATEMENT: >>> -The scheduler shall ensure that Spinlocks enforce cross-CPU mutual exclusion for scheduler data structures. +The Zephyr RTOS shall ensure that Spinlocks enforce cross-CPU mutual exclusion for Zephyr RTOS data structures. <<< [/SECTION] From 1257ec8b2aca47c72e899bb62e0129d305d35508 Mon Sep 17 00:00:00 2001 From: Joel Key Date: Mon, 12 May 2025 16:32:06 -0400 Subject: [PATCH 5/5] Scheduling: Reorganize intermingled thead requirements Moved the requirements in thread_scheduling.sdoc to submodule documents that align with their needs. --- docs/software_requirements/scheduling.sdoc | 58 +++---- .../symmetric_multiprocessing.sdoc | 80 +++++++++ docs/software_requirements/thread_events.sdoc | 28 +++ .../thread_scheduling.sdoc | 164 ------------------ docs/software_requirements/threads.sdoc | 16 +- docs/system_requirements/index.sdoc | 57 ++++-- 6 files changed, 178 insertions(+), 225 deletions(-) create mode 100644 docs/software_requirements/symmetric_multiprocessing.sdoc create mode 100644 docs/software_requirements/thread_events.sdoc delete mode 100644 docs/software_requirements/thread_scheduling.sdoc diff --git a/docs/software_requirements/scheduling.sdoc b/docs/software_requirements/scheduling.sdoc index f764ac68..0d96531b 100644 --- a/docs/software_requirements/scheduling.sdoc +++ b/docs/software_requirements/scheduling.sdoc @@ -17,7 +17,7 @@ TITLE: Thread Scheduling Algorithm UID: ZEP-SRS-23-001 STATUS: Active TYPE: Functional -COMPONENT: Scheduling +COMPONENT: Thread Scheduling TITLE: Priority-Based Selection STATEMENT: >>> The Zephyr RTOS shall select the highest priority ready thread as the current thread from the ready queue. @@ -28,10 +28,13 @@ UID: ZEP-SRS-23-002 STATUS: Active TYPE: Functional COMPONENT: Scheduling -TITLE: Deadline Enforcement (EDF) +TITLE: Earliest Deadline First Scheduling STATEMENT: >>> When earliest-deadline-first (EDF) scheduling is enabled, the Zephyr RTOS shall prioritize threads with equal static priority based on earliest deadline. <<< +USER_STORY: >>> +As a Zephyr RTOS user, I want to be able to schedule threads by earliest deadline first. +<<< [REQUIREMENT] UID: ZEP-SRS-23-003 @@ -82,6 +85,9 @@ TITLE: Cooperative Thread Non-Preemption STATEMENT: >>> The Zephyr RTOS shall ensure Cooperative threads (negative priority) retain execution until explicitly yielding or entering unready state. <<< +USER_STORY: >>> +As a Zephyr RTOS user, I want to be able to configure thread prioritizes which cannot be preempted by other user threads. +<<< [REQUIREMENT] UID: ZEP-SRS-23-007 @@ -92,6 +98,9 @@ TITLE: Preemptive Thread Interruption STATEMENT: >>> The Zephyr RTOS shall allow Preemptive threads (≥0 priority) to be interrupted immediately by higher-priority ready threads. <<< +USER_STORY: >>> +As a Zephyr RTOS user, I want that the OS preempt running threads by a thread with higher priority. +<<< [/SECTION] @@ -121,7 +130,20 @@ The Zephyr RTOS shall ensure Preemptive threads relinquish CPU after a configura [/SECTION] [SECTION] -TITLE: Zephyr RTOS Locking +TITLE: Thread Management + +[REQUIREMENT] +UID: ZEP-SRS-23- +STATUS: Draft +TYPE: Functional +COMPONENT: Scheduling +TITLE: Scheduling multiple threads +STATEMENT: >>> +The Zephyr RTOS shall provide an interface to schedule multiple threads. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-16 [REQUIREMENT] UID: ZEP-SRS-23-010 @@ -133,11 +155,6 @@ STATEMENT: >>> The Zephyr RTOS shall provide a mechanism to treat preemptive threads as cooperative until a unlock function is called. <<< -[/SECTION] - -[SECTION] -TITLE: Thread Management - [REQUIREMENT] UID: ZEP-SRS-23-011 STATUS: Active @@ -173,31 +190,6 @@ The Zephyr RTOS shall provide a mechanism to perform a busy wait where the Zephy [SECTION] TITLE: SMP Considerations -[REQUIREMENT] -UID: ZEP-SRS-23-013 -STATUS: Active -TYPE: Functional -COMPONENT: Scheduling -TITLE: Affinity Awareness -STATEMENT: >>> -The Zephyr RTOS shall honor thread-CPU affinity masks in SMP configurations. -<<< - -[REQUIREMENT] -UID: ZEP-SRS-23-014 -STATUS: Active -TYPE: Functional -COMPONENT: Scheduling -TITLE: Cross-CPU Atomicity -STATEMENT: >>> -The Zephyr RTOS shall ensure that Spinlocks enforce cross-CPU mutual exclusion for Zephyr RTOS data structures. -<<< - -[/SECTION] - -[SECTION] -TITLE: Safety and Compliance - [REQUIREMENT] UID: ZEP-SRS-23-015 STATUS: Active diff --git a/docs/software_requirements/symmetric_multiprocessing.sdoc b/docs/software_requirements/symmetric_multiprocessing.sdoc new file mode 100644 index 00000000..914d4633 --- /dev/null +++ b/docs/software_requirements/symmetric_multiprocessing.sdoc @@ -0,0 +1,80 @@ +[DOCUMENT] +TITLE: Symmetric Multiprocessing +REQ_PREFIX: ZEP-SRS-24- + +[GRAMMAR] +IMPORT_FROM_FILE: software_requirements.sgra + +[TEXT] +STATEMENT: >>> +SPDX-License-Identifier: Apache-2.0 +<<< + +[REQUIREMENT] +UID: ZEP-SRS-24- +STATUS: Draft +TYPE: Functional +COMPONENT: Multi Core +TITLE: Support operation on more than one CPU +STATEMENT: >>> +The Zephyr RTOS shall support operation on more than one physical CPU sharing the same kernel state. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-2-2 +STATUS: Draft +TYPE: Functional +COMPONENT: Multi Core +TITLE: Running threads on specific CPUs +STATEMENT: >>> +The Zephyr RTOS shall provide an interface for running threads on specific sets of CPUs ( default is 1 CPU). +<<< +USER_STORY: >>> +As a Zephyr RTOS user I want Zephyr OS to be able to specify the CPU core or the set of CPU cores on which a thread shall be executed. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-2-3 +STATUS: Draft +TYPE: Functional +COMPONENT: Multi Core +TITLE: Exclusion between physical CPUs +STATEMENT: >>> +The Zephyr RTOS shall provide an interface for mutual exclusion between multiple physical CPUs. +<<< +USER_STORY: >>> +As a Zephyr RTOS user I want Zephyr OS to provide synchronization mechanisms between the CPU cores and the access to common resources. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-24- +STATUS: Draft +TYPE: Functional +COMPONENT: Scheduling +TITLE: Affinity Awareness +STATEMENT: >>> +The Zephyr RTOS shall honor thread-CPU affinity masks in SMP configurations. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-24- +STATUS: Draft +TYPE: Functional +COMPONENT: Symmetric Multiprocessing +TITLE: Cross-CPU Atomicity +STATEMENT: >>> +The Zephyr RTOS shall ensure that Spinlocks enforce cross-CPU mutual exclusion for Zephyr RTOS data structures. +<<< + +[REQUIREMENT] +UID: ZEP-SRS-24- +STATUS: Draft +TYPE: Functional +COMPONENT: Symmetric Multiprocessing +TITLE: Time sharing of CPU resources +STATEMENT: >>> +The Zephyr RTOS shall support time sharing of CPU resources among threads of the same priority. +<<< +USER_STORY: >>> +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. +<<< diff --git a/docs/software_requirements/thread_events.sdoc b/docs/software_requirements/thread_events.sdoc new file mode 100644 index 00000000..a10c78c9 --- /dev/null +++ b/docs/software_requirements/thread_events.sdoc @@ -0,0 +1,28 @@ +[DOCUMENT] +TITLE: Thread Events +REQ_PREFIX: ZEP-SRS-25- + +[GRAMMAR] +IMPORT_FROM_FILE: software_requirements.sgra + +[TEXT] +STATEMENT: >>> +SPDX-License-Identifier: Apache-2.0 +<<< + +[REQUIREMENT] +UID: ZEP-SRS-25- +STATUS: Draft +TYPE: Functional +COMPONENT: Thread Events +TITLE: Scheduling a thread based on an event +STATEMENT: >>> +The Zephyr RTOS shall provide an interface to schedule a thread based on an event. +<<< +USER_STORY: >>> +As a Zephyr RTOS user, I want to be able to execute work which reacts on events and interrupts the current executed work. +<<< +RELATIONS: +- TYPE: Parent + VALUE: ZEP-SYRS-15 + diff --git a/docs/software_requirements/thread_scheduling.sdoc b/docs/software_requirements/thread_scheduling.sdoc deleted file mode 100644 index 01646837..00000000 --- a/docs/software_requirements/thread_scheduling.sdoc +++ /dev/null @@ -1,164 +0,0 @@ -[DOCUMENT] -TITLE: Thread Scheduling -REQ_PREFIX: ZEP-SRS-2- - -[GRAMMAR] -IMPORT_FROM_FILE: software_requirements.sgra - -[TEXT] -STATEMENT: >>> -SPDX-License-Identifier: Apache-2.0 -<<< - -[SECTION] -TITLE: Thread Scheduling - -[REQUIREMENT] -UID: ZEP-SRS-2-1 -STATUS: Draft -TYPE: Functional -COMPONENT: Multi Core -TITLE: Support operation on more than one CPU -STATEMENT: >>> -The Zephyr RTOS shall support operation on more than one physical CPU sharing the same kernel state. -<<< - -[REQUIREMENT] -UID: ZEP-SRS-2-2 -STATUS: Draft -TYPE: Functional -COMPONENT: Multi Core -TITLE: Running threads on specific CPUs -STATEMENT: >>> -The Zephyr RTOS shall provide an interface for running threads on specific sets of CPUs ( default is 1 CPU). -<<< -USER_STORY: >>> -As a Zephyr RTOS user I want Zephyr OS to be able to specify the CPU core or the set of CPU cores on which a thread shall be executed. -<<< - -[REQUIREMENT] -UID: ZEP-SRS-2-3 -STATUS: Draft -TYPE: Functional -COMPONENT: Multi Core -TITLE: Exclusion between physical CPUs -STATEMENT: >>> -The Zephyr RTOS shall provide an interface for mutual exclusion between multiple physical CPUs. -<<< -USER_STORY: >>> -As a Zephyr RTOS user I want Zephyr OS to provide synchronization mechanisms between the CPU cores and the access to common resources. -<<< - -[/SECTION] - -[SECTION] -TITLE: Thread Scheduling - -[REQUIREMENT] -UID: ZEP-SRS-2-4 -STATUS: Draft -TYPE: Functional -COMPONENT: Thread Scheduling -TITLE: Scheduling a thread based on an event -STATEMENT: >>> -The Zephyr RTOS shall provide an interface to schedule a thread based on an event. -<<< -USER_STORY: >>> -As a Zephyr RTOS user, I want to be able to execute work which reacts on events and interrupts the current executed work. -<<< -RELATIONS: -- TYPE: Parent - VALUE: ZEP-SYRS-15 - -[REQUIREMENT] -UID: ZEP-SRS-2-5 -STATUS: Draft -TYPE: Functional -COMPONENT: Thread Scheduling -TITLE: Deadline Scheduling Priorities -STATEMENT: >>> -The Zephyr RTOS shall organize running threads by earliest deadline first priority. -<<< -USER_STORY: >>> -As a Zephyr RTOS user, I want to be able to schedule threads by earliest deadline first. -<<< - -[REQUIREMENT] -UID: ZEP-SRS-2-6 -STATUS: Draft -TYPE: Functional -COMPONENT: Thread Scheduling -TITLE: Work Queue utility capable of running preemptible work items -STATEMENT: >>> -The Zephyr RTOS shall provide a thread-pooled work queue utility capable of running preemptible work items with specific scheduler priorities. -<<< -USER_STORY: >>> -As a Zephyr RTOS user, I want to be able to add work items in a thread work queue with different priorities and these shall be scheduled according their priorities. -<<< - -[REQUIREMENT] -UID: ZEP-SRS-2-7 -STATUS: Draft -TYPE: Functional -COMPONENT: Thread Scheduling -TITLE: Run user supplied functions in-order in a separate thread(s) -STATEMENT: >>> -The Zephyr RTOS shall provide an interface for running user-supplied functions. -<<< -USER_STORY: >>> -As a Zephyr RTOS user, I want to be able to run functions in-order in a separated thread/threads. -<<< - -[REQUIREMENT] -UID: ZEP-SRS-2-8 -STATUS: Draft -TYPE: Functional -COMPONENT: Thread Scheduling -TITLE: Organize running threads into a fixed list -STATEMENT: >>> -The Zephyr RTOS shall organize running threads into a fixed list of numeric priorities. -<<< -USER_STORY: >>> -As a Zephyr RTOS user, I want that the OS organize running threads in a fixed list of numeric priorities. -<<< - -[REQUIREMENT] -UID: ZEP-SRS-2-9 -STATUS: Draft -TYPE: Functional -COMPONENT: Thread Scheduling -TITLE: Preemption support -STATEMENT: >>> -The Zephyr RTOS shall support preemption of a running thread by a higher priority thread. -<<< -USER_STORY: >>> -As a Zephyr RTOS user, I want that the OS preempt running threads by a thread with higher priority. -<<< - -[REQUIREMENT] -UID: ZEP-SRS-2-10 -STATUS: Draft -TYPE: Functional -COMPONENT: Thread Scheduling -TITLE: Un-preemptible thread priorities -STATEMENT: >>> -The Zephyr RTOS shall support thread priorities which cannot be preempted by other user threads. -<<< -USER_STORY: >>> -As a Zephyr RTOS user, I want to be able to configure thread prioritizes which cannot be preempted by other user threads. -<<< - -[REQUIREMENT] -UID: ZEP-SRS-2-11 -STATUS: Draft -TYPE: Functional -COMPONENT: Thread Scheduling -TITLE: Time sharing of CPU resources -STATEMENT: >>> -The Zephyr RTOS shall support time sharing of CPU resources among threads of the same priority. -<<< -USER_STORY: >>> -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. -<<< - -[/SECTION] diff --git a/docs/software_requirements/threads.sdoc b/docs/software_requirements/threads.sdoc index fdbffa91..87591c76 100644 --- a/docs/software_requirements/threads.sdoc +++ b/docs/software_requirements/threads.sdoc @@ -17,7 +17,7 @@ TYPE: Functional COMPONENT: Threads TITLE: Creating threads STATEMENT: >>> -The Zephyr RTOS shall provide an interface to create (start) a thread. +The Zephyr RTOS shall provide an interface to create a thread. <<< RELATIONS: - TYPE: Parent @@ -149,19 +149,6 @@ RELATIONS: - TYPE: Parent VALUE: ZEP-SYRS-16 -[REQUIREMENT] -UID: ZEP-SRS-1-10 -STATUS: Draft -TYPE: Functional -COMPONENT: Threads -TITLE: Scheduling multiple threads -STATEMENT: >>> -The Zephyr RTOS shall provide an interface to schedule multiple threads. -<<< -RELATIONS: -- TYPE: Parent - VALUE: ZEP-SYRS-16 - [REQUIREMENT] UID: ZEP-SRS-1-11 STATUS: Draft @@ -197,3 +184,4 @@ RELATIONS: VALUE: ZEP-SYRS-15 - TYPE: Parent VALUE: ZEP-SYRS-16 + diff --git a/docs/system_requirements/index.sdoc b/docs/system_requirements/index.sdoc index fbab8382..679f603b 100644 --- a/docs/system_requirements/index.sdoc +++ b/docs/system_requirements/index.sdoc @@ -266,6 +266,49 @@ USER_STORY: >>> As a Zephyr RTOS user, I want to be able to give my threads different priorities for execution. <<< +[REQUIREMENT] +UID: ZEP-SYRS- +STATUS: Draft +TYPE: Functional +COMPONENT: Workqueue Threads +TITLE: Work Queue utility capable of running preemptible work items +STATEMENT: >>> +The Zephyr RTOS shall provide a thread-pooled work queue utility capable of running preemptible work items with specific scheduler priorities. +<<< +USER_STORY: >>> +As a Zephyr RTOS user, I want to be able to add work items in a thread work queue with different priorities and these shall be scheduled according their priorities. +<<< + +[REQUIREMENT] +UID: ZEP-SYRS-23 +STATUS: Draft +TYPE: Functional +COMPONENT: Thread Scheduling +TITLE: Thread Scheduling +STATEMENT: >>> +The Zephyr RTOS shall provide a scheduler that determines which thread is allowed to execute at any point in time. +<<< + +[REQUIREMENT] +UID: ZEP-SYRS- +STATUS: Draft +TYPE: Functional +COMPONENT: Thread Events +TITLE: Thread Events +STATEMENT: >>> +The Zephyr RTOS shall provide a mechanism for threads to synchronize and communicate by signaling and waiting for the occurrence of defined events. +<<< + +[REQUIREMENT] +UID: ZEP-SYRS- +STATUS: Draft +TYPE: Functional +COMPONENT: Symmetric Multiprocessing +TITLE: Symmetric Multiprocessing +STATEMENT: >>> +The Zephyr RTOS shall provide the functionality to support the use of multiple physical CPUs with Zephyr Application code. +<<< + [/SECTION] [REQUIREMENT] @@ -309,17 +352,3 @@ The Zephyr RTOS shall provide a framework to synchronize threads based on a cond [/SECTION] -[SECTION] -TITLE: Scheduling - -[REQUIREMENT] -UID: ZEP-SYRS-23 -STATUS: Draft -TYPE: Functional -COMPONENT: Scheduling -TITLE: Scheduling -STATEMENT: >>> -The Zephyr RTOS shall provide a framework to allow an application's threads to share the CPU. -<<< - -[/SECTION]