1st Edition

Real-Time Embedded Systems Open-Source Operating Systems Perspective

    534 Pages 134 B/W Illustrations
    by CRC Press

    534 Pages 134 B/W Illustrations
    by CRC Press

    From the Foreword:

    "…the presentation of real-time scheduling is probably the best in terms of clarity I have ever read in the professional literature. Easy to understand, which is important for busy professionals keen to acquire (or refresh) new knowledge without being bogged down in a convoluted narrative and an excessive detail overload. The authors managed to largely avoid theoretical-only presentation of the subject, which frequently affects books on operating systems.

    … an indispensable [resource] to gain a thorough understanding of the real-time systems from the operating systems perspective, and to stay up to date with the recent trends and actual developments of the open-source real-time operating systems."

    —Richard Zurawski, ISA Group, San Francisco, California, USA

    Real-time embedded systems are integral to the global technological and social space, but references still rarely offer professionals the sufficient mix of theory and practical examples required to meet intensive economic, safety, and other demands on system development. Similarly, instructors have lacked a resource to help students fully understand the field. The information was out there, though often at the abstract level, fragmented and scattered throughout literature from different engineering disciplines and computing sciences.

    Accounting for readers’ varying practical needs and experience levels, Real Time Embedded Systems: Open-Source Operating Systems Perspective offers a holistic overview from the operating-systems perspective. It provides a long-awaited reference on real-time operating systems and their almost boundless application potential in the embedded system domain.

    Balancing the already abundant coverage of operating systems with the largely ignored real-time aspects, or "physicality," the authors analyze several realistic case studies to introduce vital theoretical material. They also discuss popular open-source operating systems—Linux and FreRTOS, in particular—to help embedded-system designers identify the benefits and weaknesses in deciding whether or not to adopt more traditional, less powerful, techniques for a project.

    Introduction

     

    I: Concurrent Programming Concepts


    A Case Study: Vision Control

    Input Output on Computers

    Input/Output Operations and the Operating System

    Acquiring Images froma Camera Device

    Edge Detection

    Finding the Center Coordinates of a Circular Shape


    Real-Time Concurrent Programming Principles

    The Role of Parallelism

    Definition of Process

    Process State

    Process Life Cycle and Process State Diagram

    Multithreading


    Deadlock

    A Simple Example

    Formal Definition of Deadlock

    Reasoning about Deadlock: The Resource Allocation Graph

    Living with Deadlock

    Deadlock Prevention

    Deadlock Avoidance

    Deadlock Detection and Recovery


    Interprocess Communication Based on Shared Variables

    Race Conditions and Critical Regions

    Hardware-Assisted Lock Variables

    Software-Based Mutual Exclusion

    From Active to Passive Wait

    Semaphores

    Monitors


    Interprocess Communication Based on Message Passing

    Basics ofMessage Passing

    Naming Scheme

    Synchronization Model

    Message Buffers

    Message Structure and Contents

    Producer–Consumer Problem with Message Passing


    Interprocess Communication Primitives in POSIX/Linux

    Threads and Processes

    Interprocess Communication among Threads

    Interprocess Communication among Processes

    Clocks and Timers

    Threads or Processes?


    Interprocess Communication Primitives in FreeRTOS

    FreeRTOS Threads and Processes

    Message Queues

    Counting, Binary, and Mutual Exclusion Semaphores

    Clocks and Timers


    Network Communication

    The Ethernet Protocol

    TCP/IP and UDP

    Sockets

    UDP Sockets


    Lock and Wait-Free Communication

    Basic Principles and Definitions

    Multidigit Registers

    Application to the Readers/Writer Problem

    Universal Constructions

     

    II: Real-Time Scheduling Analysis


    Real-Time Scheduling Based on the Cyclic Executive

    Scheduling and Process Models

    The Cyclic Executive

    Choice of Major and Minor Cycle Length

    Tasks with Large Period or Execution Time


    Real-Time, Task-Based Scheduling

    Fixed and Variable Task Priority

    Rate Monotonic

    The EarliestDeadline First Scheduler


    Schedulability Analysis Based on Utilization

    Processor Utilization

    Sufficient Schedulability Test for Rate Monotonic

    Schedulability Test for EDF


    Schedulability Analysis Based on Response Time Analysis

    Response Time Analysis

    Computing the Worst-Case Execution Time

    Aperiodic and Sporadic Tasks


    Task Interactions and Blocking

    The Priority Inversion Problem

    The Priority Inheritance Protocol

    The Priority Ceiling Protocol

    Schedulability Analysis and Examples


    Self-Suspension and Schedulability Analysis

    Self-Suspension and the Critical Instant Theorem

    Self-Suspension and Task Interaction

    Extension of the Response Time Analysis Method

     

     

    III: Advanced Topics


    Internal Structure of FreeRTOS

    Task Scheduler/Context Switch

    Synchronization Primitives

    Porting FreeRTOS to a New Architecture


    Internal Structures and Operating Principles of Linux Real-Time Extensions

    The Linux Scheduler

    Kernel Preemption

    The PREEMPT RT Linux Patch

    The Dual-Kernel Approach


    OS Abstraction Layer

    An Object Oriented Interface to Threads and Other IPC Mechanisms

    A Sample Multiplatform Application


    Control Theory and Digital Signal Processing Primer

    Case Study 1: Controlling the Liquid Level in a Tank

    Case Study 2: Implementing a Digital Low-Pass Filter

    Biography

    Bertolotti, Ivan Cibrario; Manduchi, Gabriele