liveBook · Manning

Chapter 1: Real-time and safety-critical software

What you will learn in chapter 1 of Memory Safe C++

The section uses the CrowdStrike outage to contrast a recoverable software failure with the potentially irreversible consequences of memory errors in safety-critical systems.

After this chapter you will be able to

Section by section

Introduction

The section uses the CrowdStrike outage to contrast a recoverable software failure with the potentially irreversible consequences of memory errors in safety-critical systems.

Key terms: out-of-bounds read, runtime bounds check, IPC template, content interpreter, safety-critical software, silent data corruption, correct and timely execution

1.1 Defining safety-critical software

This section defines safety-critical software and explains the demands and development characteristics that distinguish it from conventional software.

Key terms: safety-critical, cascading failures, criticality, reliability targets, harsh environments, correctness, degraded operating conditions, safe state, assurance, safety case

1.2 Defining real-time safety-critical software

This section defines real-time safety-critical software through its correctness and timing requirements, hard deadlines, and an automatic emergency braking example.

Key terms: real-time safety-critical software, correctness, time bounds, hard real-time, soft real-time, deadline, timeliness, worst conditions, automatic emergency braking, sensor fusion

1.3 Different industries, same challenge

This section shows how industries share correctness and timing constraints and outlines common safety practices despite differing standards.

Key terms: correct and fast, deadline, signalling, hazards, fielded systems, design, functional testing, safety verification, evidence, predictability

1.4 The case for C++

This section explains why C++ remains a common choice for safety-critical systems despite its complexity and the availability of safety-oriented alternatives.

Key terms: performance, predictability, ecosystem, Ada, built-in safety features, safety-critical applications

1.4.1 Performance without overhead

This section explains how C++ provides efficient abstractions, control over memory timing, and direct hardware access for real-time safety-critical systems.

Key terms: zero-cost abstractions, std::array, raw array, garbage collection, destruction, unpredictable pause, stack pointer, stack frame, page fault, heap

1.4.2 Deterministic execution

This section explains why bounded execution time matters in safety-critical C++ and how storage choices affect timing predictability.

Key terms: determinism, predictability, worst-case execution time, WCET, stack storage, heap storage, allocator, construction, destruction, template instantiation

1.4.3 Industry maturity

This section explains how C++’s established safety-critical tooling, standards, and existing codebases support its use without proving that the language is safer.

Key terms: certified compilers, qualified static-analysis tools, coding standards, MISRA, AUTOSAR, CERT, certified toolchains, Safety-Critical Rust Consortium, codebase

1.5 Memory safety challenges

This section explains how C++ memory control can lead to undefined behavior, leaks, and silent failures that evade initial testing.

Key terms: direct memory access, manual memory management, memory leak, undefined behavior, signed integer overflow, null pointer dereference, uninitialized variables, silent memory corruption, buffer overflow

1.6 The C++ safety paradox

This section explains the C++ safety paradox: the flexibility that makes C++ broadly useful also allows memory-unsafe code to compile.

Key terms: C++ safety paradox, memory-safe code, flexibility, borrow checker, runtime checks, memory bugs

1.7 C++ memory safety triad

This section introduces the memory safety triad and traces a sensor-label defect through design, static analysis, dynamic analysis, and review.

Key terms: culture, knowledge, discipline, memory safety triad, std::copy, null-terminated C string, boundary condition, kMaxLabelLength, static analysis, rule enforcement

1.8 The complete learning cycle (CLC)

This section explains the Complete Learning Cycle for learning to recognize and address C++ defects through case studies.

Key terms: Complete Learning Cycle, Defect Discovery, Deep Technical Exploration, Guided Reimplementation, Reflection

1.9 Tools and environment

This section outlines the tools, compliance checks, and C++ versions used to work through the book’s examples.

Key terms: C++ compiler, Bazel, Git, Clang-Tidy, static analysis, dynamic analyzers, Parasoft C/C++test, MISRA C++:2023, SEI CERT C++ Coding Standard, compliance reports

1.10 Summary

Where this is used later

Concepts explained in this chapter

Chapter 2: Standards, coding guidelines, and memory safety →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.