Kyron Runtime Component Requirements#

Kyron Runtime Component Requirements
status: draft
security: YES
safety: QM
version: 1

The component requirements (comp_req) of this component are derived from the orchestration executor feature requirements of the S-CORE platform. They are added area by area. Each one carries safety: QM and is satisfied by Kyron Runtime (comp__kyron_runtime).

Some areas have no fitting platform feature requirement yet. Their requirements are listed under Requirements Without a Platform Parent without a derived_from link, until the platform adds parents (eclipse-score/score#2029). This is a recorded deviation of the module safety plan.

Component Requirements#

Executor Core#

Cooperative Async Task Execution
status: valid
security: NO
safety: QM
reqtype: Functional
testlink: TestOnlyShutdown1W2Q__test_engine_start_executed (passed); TestOnlyShutdown1W2Q__test_shutdown_action_executed (passed); TestOnlyShutdown1W2Q__test_no_actions_executed (passed); TestOnlyShutdown2W2Q__test_engine_start_executed (passed); TestOnlyShutdown2W2Q__test_shutdown_action_executed (passed); TestOnlyShutdown2W2Q__test_no_actions_executed (passed); TestSpawn__test_task_execution (passed); TestSpawnFromBoxed__test_task_execution (passed); TestSpawnFromReusable__test_task_execution[for_value] (passed); TestSpawnFromReusable__test_task_execution[for_type] (passed); TestSpawnFromReusableWithOverflow__test_task_execution[for_value] (passed); TestSpawnFromReusableWithOverflow__test_task_execution[for_type] (passed); TestSpawnFromReusableWithReuse__test_task_execution[1] (passed); TestSpawnFromReusableWithReuse__test_task_execution[15] (passed); TestSpawnFromReusableWithReuse__test_task_execution[20] (passed); TestSpawnFromReusableOnDedicated__test_task_to_worker_assignment[for_value] (passed); TestSpawnFromReusableOnDedicated__test_task_to_worker_assignment[for_type] (passed); TestSpawnFromReusableOnDedicatedWithOverflow__test_task_execution[for_value] (passed); TestSpawnFromReusableOnDedicatedWithOverflow__test_task_execution[for_type] (passed); TestSpawnFromReusableOnDedicatedWithReuse__test_regular_task_execution[1] (passed); TestSpawnFromReusableOnDedicatedWithReuse__test_regular_task_execution[15] (passed); TestSpawnFromReusableOnDedicatedWithReuse__test_regular_task_execution[20] (passed); TestRuntimeOneWorkerOneTask__test_if_task_executed (passed); TestRuntimeTwoWorkersOneTask__test_if_task_executed (passed); TestRuntimeOneWorkerManyTasks__test_if_all_tasks_executed (passed); TestRuntimeTwoWorkersEvenTasks__test_if_all_tasks_executed (passed); TestRuntimeTwoWorkersOddTasks__test_if_all_tasks_executed (passed); TestRuntimeThreeWorkersEvenTasks__test_if_all_tasks_executed (passed); TestRuntimeThreeWorkersOddTasks__test_if_all_tasks_executed (passed); TestRuntimeYieldingTasks__test_tasks_polled_until_complete (passed); TestThreeBlockedWorkersWithOneUnblocked__test_if_non_blocking_tasks_executed_in_the_middle (passed); TestThreeBlockedWorkersWithOneUnblocked__test_if_non_blocking_tasks_executed_on_the_same_thread (passed)
version: 1

The runtime shall execute tasks provided as Rust futures (async/await) on its async worker threads, polling each task cooperatively until it completes.

Fixed Async Worker Pool
status: valid
security: NO
safety: QM

An execution engine shall run its async tasks on a fixed number of async worker threads. The number is configured when the engine is built, in the range 1 to 128, and does not change while the engine runs. A configuration outside this range shall be rejected when the engine is built.

Multiple Isolated Execution Engines
status: valid
security: NO
safety: QM

The runtime shall support multiple execution engines, each with its own async worker threads. A task shall run only on the worker threads of the execution engine it was spawned into.

Blocking Work#

Dedicated Workers
status: valid
security: NO
safety: QM

An execution engine shall support dedicated workers. Each dedicated worker runs on its own OS thread outside the async worker pool and is identified by a unique worker ID. A blocking call on a dedicated worker shall not block the async workers, and a blocking call on an async worker shall not block the dedicated workers. Registering the same worker ID twice shall be rejected when the engine is built.

Worker Threads#

Uniform Async Worker Priority
status: valid
security: NO
safety: QM

All async workers of an execution engine shall run with the same OS thread priority and scheduler type, configured once per execution engine. If only one of the two is configured, both shall be inherited from the thread that starts the execution engine.

Task Scheduling#

No Task Priorities
status: valid
security: NO
safety: QM

The operations that spawn a task on the async workers shall not take a task priority, and the scheduler shall not order the tasks of an execution engine by priority.

FIFO Task Queues
status: valid
security: NO
safety: QM

Each async worker shall take the tasks of its local task queue in FIFO order. It shall also take tasks from the global queue of its execution engine at regular intervals, so that a busy local queue does not starve the tasks in the global queue.

Task Queue Size
status: valid
security: NO
safety: QM
reqtype: Functional
testlink: TestTaskQueueSize_Valid__test_valid[1] (passed); TestTaskQueueSize_Valid__test_valid[2] (passed); TestTaskQueueSize_Valid__test_valid[3] (passed); TestTaskQueueSize_Valid__test_valid[4] (passed); TestTaskQueueSize_Valid__test_valid[5] (passed); TestTaskQueueSize_Valid__test_valid[6] (passed); TestTaskQueueSize_Valid__test_valid[7] (passed); TestTaskQueueSize_Valid__test_valid[8] (passed); TestTaskQueueSize_Valid__test_valid[9] (passed); TestTaskQueueSize_Valid__test_valid[10] (passed); TestTaskQueueSize_Valid__test_valid[11] (passed); TestTaskQueueSize_Valid__test_valid[12] (passed); TestTaskQueueSize_Valid__test_valid[13] (passed); TestTaskQueueSize_Valid__test_valid[14] (passed); TestTaskQueueSize_Valid__test_valid[15] (passed); TestTaskQueueSize_Valid__test_valid[16] (passed); TestTaskQueueSize_Valid__test_valid[17] (passed); TestTaskQueueSize_Valid__test_valid[18] (passed); TestTaskQueueSize_Valid__test_valid[19] (passed); TestTaskQueueSize_Valid__test_valid[20] (passed); TestTaskQueueSize_Valid__test_valid[21] (passed); TestTaskQueueSize_Valid__test_valid[22] (passed); TestTaskQueueSize_Valid__test_valid[23] (passed); TestTaskQueueSize_Valid__test_valid[24] (passed); TestTaskQueueSize_Valid__test_valid[25] (passed); TestTaskQueueSize_Valid__test_valid[26] (passed); TestTaskQueueSize_Valid__test_valid[27] (passed); TestTaskQueueSize_Valid__test_valid[28] (passed); TestTaskQueueSize_Valid__test_valid[29] (passed); TestTaskQueueSize_Valid__test_valid[30] (passed); TestTaskQueueSize_Valid__test_valid[31] (passed); TestTaskQueueSize_Invalid__test_invalid[0] (passed); TestTaskQueueSize_Invalid__test_invalid[1] (passed); TestTaskQueueSize_Invalid__test_invalid[10] (passed); TestTaskQueueSize_Invalid__test_invalid[321] (passed); TestTaskQueueSize_Invalid__test_invalid[1234] (passed); TestTaskQueueSize_Invalid__test_invalid[65535] (passed); TestTaskQueueSize_Invalid__test_invalid[4294967295] (passed)
version: 1

The size of the local task queue of the async workers shall be configurable per execution engine. A size that is smaller than 2 or not a power of two shall be rejected as a non-recoverable error when the execution engine is configured.

Task Queue Overflow
status: valid
security: NO
safety: QM

When the local task queue of an async worker is full, tasks shall move to the global queue of the execution engine. When the global queue is also full, spawning a task shall be reported as a non-recoverable error.

Cooperative Yielding#

Yield Operation
status: valid
security: NO
safety: QM

The runtime shall provide an operation with which a task gives control back to its worker, so that other queued tasks can run before the task continues.

Yielding Guideline
status: valid
security: NO
safety: QM
reqtype: Non-Functional
version: 1

The user manual shall describe how to divide long-running operations into cooperatively yielding segments, and when to use a dedicated worker instead.

Timers and Channels#

Async Sleep
status: valid
security: NO
safety: QM
reqtype: Functional
testlink: TestSleepDuration__test_completeness[workers_1-sleep_0ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_0ms-workers_1] (passed); TestSleepDuration__test_completeness[workers_1-sleep_10ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_10ms-workers_1] (passed); TestSleepDuration__test_completeness[workers_4-sleep_10ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_10ms-workers_4] (passed); TestSleepDuration__test_completeness[workers_4-sleep_0ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_0ms-workers_4] (passed); TestSleepDuration__test_completeness[workers_4-sleep_50ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_50ms-workers_4] (passed); TestSleepDuration__test_completeness[workers_1-sleep_50ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_50ms-workers_1] (passed); TestSleepDuration__test_completeness[workers_4-sleep_100ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_100ms-workers_4] (passed); TestSleepDuration__test_completeness[workers_1-sleep_100ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_100ms-workers_1] (passed); TestSleepDuration__test_completeness[workers_4-sleep_500ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_500ms-workers_4] (passed); TestSleepDuration__test_completeness[workers_1-sleep_500ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_500ms-workers_1] (passed); TestSleepDuration__test_completeness[workers_4-sleep_1000ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_1000ms-workers_4] (passed); TestSleepDuration__test_completeness[workers_1-sleep_1000ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_1000ms-workers_1] (passed); TestSleepDuration__test_completeness[workers_4-sleep_3000ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_3000ms-workers_4] (passed); TestSleepDuration__test_completeness[workers_1-sleep_3000ms] (passed); TestSleepDuration__test_sleep_duration_strict[sleep_3000ms-workers_1] (passed); TestMultipleSleepsWithRegularTasks__test_task_completeness[workers_1] (passed); TestMultipleSleepsWithRegularTasks__test_sleep_duration[workers_1] (passed); TestMultipleSleepsWithRegularTasks__test_task_completeness[workers_4] (passed); TestMultipleSleepsWithRegularTasks__test_sleep_duration[workers_4] (passed); TestMultipleSleepsWithBlockedWorkers__test_task_completeness (passed); TestMultipleSleepsWithBlockedWorkers__test_sleep_duration (passed)
version: 1

The runtime shall provide an asynchronous sleep that completes no earlier than the requested duration and does not block its worker thread, so that other tasks run while a task sleeps.

Broadcast Channel
status: valid
security: NO
safety: QM
reqtype: Functional
testlink: TestSPMCBroadcastChannelSendReceive__test_if_sends_succeeded[1] (passed); TestSPMCBroadcastChannelSendReceive__test_if_receives_succeeded[1] (passed); TestSPMCBroadcastChannelSendReceive__test_if_sends_succeeded[2] (passed); TestSPMCBroadcastChannelSendReceive__test_if_receives_succeeded[2] (passed); TestSPMCBroadcastChannelSendReceive__test_if_sends_succeeded[3] (passed); TestSPMCBroadcastChannelSendReceive__test_if_receives_succeeded[3] (passed); TestSPMCBroadcastChannelSendReceive__test_if_sends_succeeded[4] (passed); TestSPMCBroadcastChannelSendReceive__test_if_receives_succeeded[4] (passed); TestSPMCBroadcastChannelSendReceive__test_if_sends_succeeded[8] (passed); TestSPMCBroadcastChannelSendReceive__test_if_receives_succeeded[8] (passed); TestSPMCBroadcastChannelOverflow__test_overflow[clone] (passed); TestSPMCBroadcastChannelOverflow__test_overflow[subscribe] (passed); TestSPMCBroadcastChannelZeroMaxReceivers__test_zero_max_receiver_count (passed); TestSPMCBroadcastChannelBigMaxReceivers__test_big_max_receiver_count[65535] (passed); TestSPMCBroadcastChannelBigMaxReceivers__test_big_max_receiver_count[60000] (passed); TestSPMCBroadcastChannelBigMaxReceivers__test_big_max_receiver_count[4095] (passed); TestSPMCBroadcastChannelBigMaxReceivers__test_big_max_receiver_count[3000] (passed); TestSPMCBroadcastChannelBigMaxReceivers__test_big_max_receiver_count[255] (passed); TestSPMCBroadcastChannelNumOfSubscribers__test_initial_num_of_subscribers[clone] (passed); TestSPMCBroadcastChannelNumOfSubscribers__test_additional_receivers_with_overflow[clone] (passed); TestSPMCBroadcastChannelNumOfSubscribers__test_remove_receivers[clone] (passed); TestSPMCBroadcastChannelNumOfSubscribers__test_initial_num_of_subscribers[subscribe] (passed); TestSPMCBroadcastChannelNumOfSubscribers__test_additional_receivers_with_overflow[subscribe] (passed); TestSPMCBroadcastChannelNumOfSubscribers__test_remove_receivers[subscribe] (passed); TestSPMCBroadcastChannelDropAddReceiver__test_if_sends_succeeded (passed); TestSPMCBroadcastChannelDropAddReceiver__test_if_receives_succeeded (passed); TestSPMCBroadcastChannelOneLaggingReceiver__test_valid_send_tasks (passed); TestSPMCBroadcastChannelOneLaggingReceiver__test_overflow_send_tasks (passed); TestSPMCBroadcastChannelOneLaggingReceiver__test_receiver_lagging_task (passed); TestSPMCBroadcastChannelOneLaggingReceiver__test_receiver_valid_tasks (skipped); TestSPMCBroadcastChannelWithDroppingReceivers__test_valid_send_task (passed); TestSPMCBroadcastChannelWithDroppingReceivers__test_no_receivers_send_task (passed); TestSPMCBroadcastChannelWithDroppingReceivers__test_receiving_tasks (passed); TestSPMCBroadcastChannelWithDroppingSender__test_send_task (passed); TestSPMCBroadcastChannelWithDroppingSender__test_receiving_tasks (passed)
version: 1

The runtime shall provide a bounded single-producer broadcast channel that delivers every value to every receiver. The maximum number of receivers is set when the channel is created: adding a receiver beyond it shall fail, and a maximum of zero shall be rejected. Sending shall report an overflow for a receiver whose buffer is full, without blocking the sender or the other receivers.

Dedicated Worker Threads#

Dedicated Worker Affinity
status: valid
security: NO
safety: QM

The CPU affinity of each dedicated worker shall be configurable. An affinity that names a CPU core outside the supported range shall be rejected with an error.

Requirements Without a Platform Parent#

The platform has no feature requirement yet that these requirements can be derived from (eclipse-score/score#2029). They have no derived_from link until it does. The safety worker requirements are QM like the rest of Kyron: no safety goal may rely on them (see Kyron Safety Plan).

Worker Thread Parameters
status: valid
security: NO
safety: QM

The thread stack size of the async workers, and the thread priority, scheduler and stack size of each dedicated worker, shall be configurable. A stack size below the minimum of the operating system shall be rejected with an error.

Spawn From Reusable Futures
status: valid
security: NO
safety: QM

The runtime shall spawn tasks from a pool of reusable futures, on the async workers and on a dedicated worker. Taking a future from an exhausted pool shall fail with an error, and a future shall be available again after its task completes.

TCP Networking
status: valid
security: YES
safety: QM
reqtype: Interface
testlink: TestTcpServer__test_tcp_echo (passed); TestTcpServer__test_multiple_connections (passed); TestTcpServer__test_server_logs (passed); TestTcpNoResponseServer__test_server_logs (passed); TestTcpPollWriteServer__test_tcp_echo (passed); TestTcpPollWriteServer__test_server_logs (passed); TestSmoke__test_connect_parallel_ok[v4] (passed); TestSmoke__test_connect_serially_ok[v4] (passed); TestSmoke__test_addrs_ok[v4] (passed); TestSmoke__test_connect_parallel_ok[v6] (passed); TestSmoke__test_connect_serially_ok[v6] (passed); TestSmoke__test_addrs_ok[v6] (passed); TestTTL_Valid__test_ttl_ok[None-v4] (passed); TestTTL_Valid__test_ttl_ok[None-v6] (passed); TestTTL_Valid__test_ttl_ok[1-v6] (passed); TestTTL_Valid__test_ttl_ok[1-v4] (passed); TestTTL_Valid__test_ttl_ok[64-v6] (passed); TestTTL_Valid__test_ttl_ok[64-v4] (passed); TestTTL_Valid__test_ttl_ok[128-v6] (passed); TestTTL_Valid__test_ttl_ok[128-v4] (passed); TestTTL_Valid__test_ttl_ok[255-v6] (passed); TestTTL_Valid__test_ttl_ok[255-v4] (passed); TestTTL_Invalid__test_ttl_invalid[v4-0] (passed); TestTTL_Invalid__test_ttl_invalid[v6-0] (passed); TestSmoke__test_message_ok[0-v4] (passed); TestSmoke__test_addrs_ok[v4-0] (passed); TestSmoke__test_message_ok[0-v6] (passed); TestSmoke__test_addrs_ok[v6-0] (passed); TestSmoke__test_message_ok[1-v6] (passed); TestSmoke__test_addrs_ok[v6-1] (passed); TestSmoke__test_message_ok[1-v4] (passed); TestSmoke__test_addrs_ok[v4-1] (passed); TestSmoke__test_message_ok[20-v6] (passed); TestSmoke__test_addrs_ok[v6-20] (passed); TestSmoke__test_message_ok[20-v4] (passed); TestSmoke__test_addrs_ok[v4-20] (passed); TestSmoke__test_message_ok[1024-v6] (passed); TestSmoke__test_addrs_ok[v6-1024] (passed); TestSmoke__test_message_ok[1024-v4] (passed); TestSmoke__test_addrs_ok[v4-1024] (passed); TestTTL_Valid__test_ttl_ok[None-v4] (passed); TestTTL_Valid__test_ttl_ok[None-v6] (passed); TestTTL_Valid__test_ttl_ok[1-v6] (passed); TestTTL_Valid__test_ttl_ok[1-v4] (passed); TestTTL_Valid__test_ttl_ok[64-v6] (passed); TestTTL_Valid__test_ttl_ok[64-v4] (passed); TestTTL_Valid__test_ttl_ok[128-v6] (passed); TestTTL_Valid__test_ttl_ok[128-v4] (passed); TestTTL_Valid__test_ttl_ok[255-v6] (passed); TestTTL_Valid__test_ttl_ok[255-v4] (passed); TestTTL_Invalid__test_ttl_invalid[v4-0] (passed); TestTTL_Invalid__test_ttl_invalid[v6-0] (passed)
version: 1
satisfied by: comp__kyron_runtime

The runtime shall provide asynchronous TCP listeners and streams for IPv4 and IPv6: bind, accept, connect, read, write, and reading and setting the IP time-to-live. Setting an invalid time-to-live shall be reported as an error.

UDP Networking
status: valid
security: YES
safety: QM

The runtime shall provide asynchronous UDP sockets for IPv4 and IPv6: bind, connect, send and receive, send to and receive from an address, and reading and setting the IP time-to-live. Sending on an unconnected socket without a destination address, and setting an invalid time-to-live, shall be reported as errors.

Safety API Availability
status: valid
security: NO
safety: QM

Without a safety worker in the execution engine, the safety API shall run tasks like the regular API. kyron::safety::ensure_safety_enabled shall report a non-recoverable error when the engine has no safety worker or when it is called outside the runtime.

Safety Worker Error Handling
status: valid
security: NO
safety: QM

When a safety task completes with an error, and the task awaiting its result is waiting for it at that moment, the runtime shall continue the awaiting task on the safety worker thread.

Overview#

ID

Title

Safety

Security

Status

Derived From

comp_req__kyron_runtime__async_task_exec

Cooperative Async Task Execution

QM

NO

valid

comp_req__kyron_runtime__broadcast_channel

Broadcast Channel

QM

NO

valid

comp_req__kyron_runtime__dedicated_affinity

Dedicated Worker Affinity

QM

NO

valid

comp_req__kyron_runtime__dedicated_locality

Dedicated Worker Task Locality

QM

NO

valid

comp_req__kyron_runtime__dedicated_unknown_id

Spawn on Unregistered Dedicated Worker

QM

NO

valid

comp_req__kyron_runtime__dedicated_worker

Dedicated Workers

QM

NO

valid

comp_req__kyron_runtime__fifo_task_queue

FIFO Task Queues

QM

NO

valid

comp_req__kyron_runtime__fixed_worker_pool

Fixed Async Worker Pool

QM

NO

valid

comp_req__kyron_runtime__multi_engine

Multiple Isolated Execution Engines

QM

NO

valid

comp_req__kyron_runtime__no_task_prio

No Task Priorities

QM

NO

valid

comp_req__kyron_runtime__reusable_spawn

Spawn From Reusable Futures

QM

NO

valid

comp_req__kyron_runtime__safety_api

Safety API Availability

QM

NO

valid

comp_req__kyron_runtime__safety_err_handling

Safety Worker Error Handling

QM

NO

valid

comp_req__kyron_runtime__sleep

Async Sleep

QM

NO

valid

comp_req__kyron_runtime__spsc_channel

Single-Producer Single-Consumer Channel

QM

NO

valid

comp_req__kyron_runtime__task_queue_overflow

Task Queue Overflow

QM

NO

valid

comp_req__kyron_runtime__task_queue_size

Task Queue Size

QM

NO

valid

comp_req__kyron_runtime__tcp

TCP Networking

QM

YES

valid

comp_req__kyron_runtime__thread_params

Worker Thread Parameters

QM

NO

valid

comp_req__kyron_runtime__udp

UDP Networking

QM

YES

valid

comp_req__kyron_runtime__worker_affinity

Async Worker Affinity

QM

NO

valid

comp_req__kyron_runtime__worker_prio

Uniform Async Worker Priority

QM

NO

valid

comp_req__kyron_runtime__yield_guideline

Yielding Guideline

QM

NO

valid

comp_req__kyron_runtime__yield_now

Yield Operation

QM

NO

valid

Parent Feature Requirements#

ID

Title

Safety

Status

Async Cooperative Task Runtime

QM

valid

Dedicated Threads for Blocking Operations

QM

valid

FIFO or Fairness Scheduling

QM

valid

Fixed-Size Thread Pool

QM

valid

No Internal Priorities for Cooperative Tasks

QM

valid

Uniform OS Priority for Non-Safety Threads

QM

valid

Isolated Thread Pools

QM

valid

Scale via Additional Executors

QM

valid

Configurable Thread Affinity

QM

valid

Yielding Guidelines for Long Operations

QM

valid