Exploring QuarkTS: An Open Source Event-Driven Embedded Operating System

Follow+Star Public Account, don’t miss out on exciting content

Exploring QuarkTS: An Open Source Event-Driven Embedded Operating System
Source | Embedded Miscellaneous

GitHub link: https://github.com/kmilo17pet/QuarkTS

Open Source License: MIT license

1. Introduction to QuarkTS

Exploring QuarkTS: An Open Source Event-Driven Embedded Operating System

QuarkTS is an open-source embedded operating system designed to provide a modern development environment for small embedded applications, helping developers build stable and predictable event-driven multitasking software. Its features include:

  • Priority Cooperative Scheduling: Tasks manage their own lifecycle, avoiding the complexities brought by preemption, and reducing reentrancy issues.

  • Time Control: Provides timed tasks and software timers, facilitating time-related operations.

  • Inter-task Communication Mechanisms: Provides queues, notifications, event flags, and other mechanisms for effective communication between tasks.

  • State Machine Support: Provides support for hierarchical state machines, simplifying the implementation of complex logic.

  • Coroutines: Supports coroutines, enhancing code efficiency and simplifying concurrent programming.

  • AT Command Line Interface: Provides a simple command line interface for easy debugging and interaction.

  • Safe and Reliable: Adheres to MISRA C 2012 and CERT coding standards, with multiple static analysis checks to ensure code safety and reliability.

2. Priority Cooperative Scheduling

Priority cooperative scheduling is a task scheduling strategy where tasks manage their own lifecycle and switch tasks at programmer-specified points. This scheduling method avoids common complexities in preemptive scheduling, such as resource contention, deadlocks, and priority inversion.

In priority cooperative scheduling, each task has a priority, but tasks are not forcibly interrupted by external events or time slices.

Instead, tasks voluntarily relinquish the CPU upon completing their current operation or reaching a programmer-specified switching point, thus making task switching more controllable and predictable.

Features:

  • Reduces Reentrancy Issues: Since tasks are not arbitrarily interrupted by other tasks and only switch at programmer-allowed points, it lowers common reentrancy issues in concurrent programming.

  • Simplifies Resource Sharing: Resource contention issues between tasks are easier to manage because task switching is controllable.

  • Avoids Deadlocks: Cooperative scheduling avoids common deadlock issues in preemptive scheduling since task switching is deterministic.

Other common task scheduling strategies include:

Preemptive Scheduling

Preemptive scheduling is a task scheduling strategy where tasks can be forcibly interrupted by external events (such as interrupts) or time slices expiring, allowing higher-priority tasks to take over the CPU.

Features:

  • Fast Response Speed: High-priority tasks can immediately preempt the CPU, ensuring quick responses to urgent events.

  • Resource Contention: Since tasks can be preempted, additional synchronization mechanisms are needed to manage resource contention.

  • High Complexity: Preemptive scheduling increases system complexity, as it requires consideration of context saving and restoring during task switching, priority inversion, and other issues.

Time-Slice Scheduling

Time-slice scheduling is a special type of preemptive scheduling strategy where each task is allocated a fixed-length time slice. When a task completes its time slice, it is forcibly interrupted and control is passed to the next ready task, regardless of whether it has finished.

Features:

  • Fairness: By allocating time slices to each task, it ensures that all tasks have the opportunity to access CPU resources.

  • Context Switching Overhead: Frequent task switching incurs additional overhead for context saving and restoring.

  • Suitable for Multi-tasking Environments: Time-slice scheduling is particularly suitable for multi-user systems that need to handle multiple tasks simultaneously.

Comparison

Priority Cooperative Scheduling Preemptive Scheduling Time-Slice Scheduling
Task Switching Programmer Controlled External Events or Time Slice Expiry Time Slice Expiry
Reentrancy Issues Reduced Increased Increased
Resource Sharing Simplified Complex Complex
Deadlocks Avoided Possible Possible
Response Speed Medium (depends on programmer design) Fast Fast (but limited by time slice length)
System Complexity Low High Medium (requires management of time slices and context switching)
Fairness Uncertain (depends on programmer design) Uncertain (depends on priority allocation) High

Priority cooperative scheduling, preemptive scheduling, and time-slice scheduling each have their pros and cons.

Priority cooperative scheduling is suitable for systems that need to simplify resource sharing and avoid deadlocks, but its response speed may not be as fast as preemptive scheduling.

Preemptive scheduling is suitable for systems that require rapid response to urgent events, but it increases system complexity and resource contention issues.

Time-slice scheduling provides a fair way to allocate CPU resources, suitable for multi-tasking environments, but introduces additional context switching overhead.

3. QuarkTS Application Scenarios

The design goal of QuarkTS is to utilize a compact, simple, and most importantly robust implementation to achieve its stated functionality, making it suitable for resource-constrained microcontrollers, where full preemptive real-time operating systems are excessive and their inclusion adds unnecessary complexity to firmware development.

Additionally, with state machine support, coroutines, time control, and inter-process communication primitives, QuarkTS provides a modern environment for building stable, predictable event-driven multitasking embedded software.

Its modularity and reliability make this operating system an ideal choice for efficient development of a range of applications on low-power devices, including automotive control systems, monitoring, and the Internet of Things.

———— END ————

Exploring QuarkTS: An Open Source Event-Driven Embedded Operating System

● Column “Embedded Tools”

● Column “Embedded Development”

● Column “Keil Tutorials”

● Selected Tutorials in Embedded Column

Follow the public account reply “Add Group” to join the technical exchange group as per the rules, reply “1024” for more content.

Click “Read Original” for more shares.

Leave a Comment

×