Paper: What Every Systems Programmer Should Know About Lockless Concurrency

21 May 2020 by Phillip Johnston • Last updated 15 August 2023 “What Every Systems Programmer Should Know About Lockless Concurrency” is a short paper by Matt Kline that explores ways we can synchronize concurrent operations without relying on standard OS constructs, such as mutexes, semaphores, and condition variables. These strategies are also used to implement those same OS constructs. The paper also briefly touches on sources of concurrency problems that arise from compilers and from the hardware itself. Note: This paper was featured as a Reading Club assignment. Files What Every Systems Programmer Should Know About Lockless Concurrency Archive …

To access this content, you must purchase a Membership - check out the different options here. If you're a member, log in.

Enabling Users to Override Functions in C & C++

8 May 2020 by Phillip Johnston • Last updated 14 December 2021 There are many cases were we want to give our users the ability to override functions in a library or module. This is often for be for customization or optimization purposes. The Pattern With many C and C++ compilers, we can declare function and variable definitions as “weakly linked” using __attribute__((weak)) or the __weak alias: __attribute__((weak)) void weak_function() { // Intentional no-op } Note: While ELF allows you to declare a symbol with weak linkage and not supply a definition, this approach will fail with Mach-O objects and …

To access this content, you must purchase a Membership - check out the different options here. If you're a member, log in.

Q&A: How can I use C++ on Embedded Projects when I can’t use the Heap?

One of our most common reader questions about using C++ for embedded projects is: How can I use C++ on my embedded projects when I can't use the heap? There are three approaches we recommend: Use the Embedded Template Library (ETL) This library provides STL-like types that support static memory allocation Other helpful types are …

Enforce Correct Integer Arithmetic using the C++ Safe Numerics Library

The Boost Safe Numerics library, created by Robert Ramey aims to enforce correct mathematical operations with the C++ language. Why are safer numeric operations needed? C++ inherited the behavior of the integral types (int, unsigned, long, etc.) from the C language, where they were designed to map closely to the underlying processor hardware. The types …

June 2019: Programmer vs Engineer, Coroutines, Report CI

3 June 2019 by Phillip Johnston • Last updated 27 September 2019 Welcome to the June 2019 edition of the Embedded Artistry Newsletter! This is a monthly newsletter of curated and original content to help you build superior embedded systems. This newsletter supplements the website and covers topics not mentioned there. This month we’ll cover: Programming vs engineeringCoroutinesReport CIEmbedded news from around the webUpdates to the Embedded Artistry Website We also want to share some exciting news with you! One of our articles was published in the June 2019 issue of the Software Quality Professional Journal. You can read The …

To access this content, you must purchase a Membership - check out the different options here. If you're a member, log in.

Improve volatile Usage with volatile_load() and volatile_store()

A C++ proposal for deprecating the volatile keyword has surfaced. This may surprise our readers, because as Michael Caisse said, "volatile is the embedded keyword." The original intent of the volatile keyword in C89 is to suppress read/write optimizations: No cacheing through this lvalue: each operation in the abstract semantics must be performed (that is, …