Singleton Pattern in Embedded C: Writing ‘Globally Unique’ More Stably

In embedded projects, some resources are inherently unique: watchdog timers, RTCs, system clocks, debug serial ports, loggers, system configuration managers, CRC modules… If these modules are carelessly piled up with global variables, issues such as initialization order chaos, difficult-to-trace write access, and ISR/task concurrency collisions will inevitably arise. The goal of the singleton pattern is … Read more

From Beginner to Abandonment in Rust Concurrency: Thread Pool Edition

Comparison Summary of Rust Thread Pool Libraries 2.1 Rayon Thread Pool •Core Features: Based on a data parallel model, automatically manages the thread pool, supports <span>join</span> for parallel task execution•Advantages: •Threads are reusable, avoiding the overhead of frequent creation/destruction•Automatically adjusts the number of threads based on CPU core count•Provides <span>scope</span> to create child threads, supporting … Read more

Embedded Reading Notes – 3: Detailed Explanation of Linux Device Driver Development

Concurrency Control in Linux Device Drivers (Part 1) Note: The content of this article is excerpted from “Detailed Explanation of Linux Device Driver Development – Based on the Latest Linux 4.0 Kernel”. This series will record the key points of knowledge focused on while reading the book. Interested readers are recommended to read the original … Read more

Learning Rust Today: Escaping Callback Hell! The Redemption Path of Asynchronous Programming in Rust!

💡 Core Idea: Rust simplifies asynchronous programming through async/.await, making concurrent task handling more intuitive.🧠 Detailed Knowledge Points: In Rust, the async and await keywords make writing asynchronous code straightforward. async is used to define an asynchronous function or block, while await is used to pause the execution of the current asynchronous function until a … Read more

C++ Multithreading Magic Guide: Build Your Own Thread Factory

Stop hiring temporary workers on the street; build your own factory. A thread pool is essentially a factory. It employs a fixed number of workers (threads) and continuously receives tasks (work) that these workers will complete in turn. This is the core idea of a thread pool: Instead of hiring a worker for each task … Read more

CS110L Learning Notes (Part 4): Concurrency Programming in Rust

Introduction In the previous summary of the CS110L course, we have seen how Rust builds a solid memory safety fortress in a single-threaded environment through its Ownership and Borrowing system. However, such scenarios are rare in modern systems programming. To fully utilize the performance of multi-core processors and handle I/O-intensive tasks such as network requests, … Read more

C++ Multithreading Magic Guide: The Atomic Button Machine

⚛️ std::atomic — The Mysterious Power of the Atomic Button Machine ⚙️ <span>std::atomic</span> is a concurrent primitive provided by C++, allowing you to operate on a variable in a multithreaded environment without needing locks to ensure consistency. Its core goal: “To allow multiple threads to read and write to a variable simultaneously without conflicts, without … Read more

In-Depth Understanding of C++ Happens-Before: A Must for Advanced Concurrent Programmers

1. Introduction: Why is Happens-Before Necessary? In multithreaded programs, “statement order” ≠ “execution order”.Modern CPUs and compilers can reorder instructions as long as the results in a single thread remain unchanged, allowing for free optimization.However, in concurrent scenarios, this can lead to serious issues: bool ready = false;int data = 0; void writer() { data … Read more

tsink – High-Performance Rust Embedded Time Series Database

Project Overview tsink is a high-performance embedded time series database engine written in Rust, focusing on efficient storage and retrieval of time series data. This project is open-source under the MIT license, featuring lightweight and high-performance characteristics, making it particularly suitable for applications that need to handle large amounts of time series data. Core Features … Read more

A Quick Start Guide to FreeRTOS

FreeRTOS is a widely used real-time operating system kernel for embedded systems. 1. What is FreeRTOS? Essence: It is an open-source (MIT licensed), configurable real-time operating system (RTOS) kernel. Core Features: Characteristics: Small resource footprint: The kernel itself typically compiles to only 6KB – 12KB of ROM and a few hundred bytes of RAM (depending … Read more