Resources on (Real-Time) Operating Systems Design

GPOS and RTOS design

This is a curated list. Nothing I mention here I haven’t read – at least partially.

To learn how to design your own RTOS, you’ll need to gather information from various sources, including those intended for general-purpose operating systems (GPOS). While information on GPOS is widely available, it’s rarely presented practically. Even rarer is a book focused solely on embedded system software, let alone one dedicated to designing and implementing real-time operating systems (RTOS); I know of only two and a half such books. Typically, books cover real-time embedded systems, encompassing both hardware and software. Regarding system software, they tend to be hands-on guides for using an RTOS (often FreeRTOS for small devices (or some ARM-locked approach) and Linux with real-time extensions and pthreads for high-end devices).

G P O S

The triad of Tanenbaum, Stallings and Silberschatz is always valid, if you are aware they are dense textbooks.

In my opinion, Stallings takes a better approach to providing internal details of operating systems. It is also the only one that covers embedded OS and additional topics like queueing theory and stochastic processes. Tanenbaum’s last chapter is a very nice read. Silberschatz’s didactics are better than both, though.

There are more streamlined excellent books as well.

  • Lister, A. M., & Eager, R. D. (1993). Fundamentals of operating systems.

This book takes a unique approach, teaching operating system concepts while “designing” an OS in pseudo-code. These fundamentals are still valid, and that is the book’s value. It is short, just over 200 pages.

  • Wang, K. C. Design and Implementation of the MTX Operating System. Springer International Publishing.

Here, using QEMU for x86-32, the author details a UNIX-like design and implementation . From 16-bit real mode, to 32-bit protected mode. Bootloader, Scheduler, System Calls, IPCs, Drivers and an ext2 File System. Hands-on.

  • Douglas Comer. Operating System Design. The Xinu approach.

It is one of the few GPOS books that can guide you through implementing your own kernel. I have bought the last edition, and if you still have the fourth it does not add too much for the price.

  • Dominic Giampaolo. Practical File System Design with the Be File System

The filesystem of the (historical) BeOS is detailed.

  • Vahalia, U. (1996). UNIX Internals: The New Frontiers.

Now, here, it details the internals of several UNIX flavours from that time: SVR4, 4.4BSD, Mach, Solaris and Digital Unix. More attention is given to SVR4. Each kernel component for these variants is detailed on its design choices, and it discusses the advantages and drawbacks of each approach. I think this book is a gem.

  • Love, Robert. Linux Kernel Development Third Edition.

Love wrote a book on Linux systems programming. This one dives in the details of Linux 2.6.x implementation. So, lots of insights for those developing their own kernel.

  • McKusick. Design And Implementation of the FreeBSD Operating System. 2nd ed.

There are also books on the former 4.3./4.4BSD.

  • Bach. Design and Implementation of the UNIX Operating System

The classic SystemV. Plenty of snippets.

  • McDougall. Solaris 10 and OpenSolaris Kernel Architecture 2nd ed.

Solaris is the SystemV closest son.

  • John Lions – Lions’ Commentary on UNIX 6th Edition, with Source Code
    Now think about something that has aged well. Its free on UNSW website.

Those UNIXes internals, I don’t think any does better than Love’s, Vahalia’s and Lions.

  • Solomon, Aliev et al. Windows Internals. Part 1 and 2

Windows NT kernel is pretty elegant in my opinion. These books describe it as they can.

  • Hansen. Classic Operating Systems

Brinch Hansen coined the kernel concept as we know it – he regarded as a Nucleus. It was backed on the “Monitor” concept (that Hoare extend afterwards). He also has a textbook on Operating Systems (that I don’t think has aged very well). This book I mention is a collection of academic papers on several stages of OS development, split in 7 stages: “Open shop”, Batch, Multiprogramming, Time Sharing, Concurrent Programming, Personal Computing and Distributed Systems. Besides Hansen, you will be reading just giants like Corbato, Dijkstra, Liskov, Ritchie…

R T O S

  • Bertolotti, Ivan Cibrario; Manduchi, Gabriele. Real-Time Embedded Systems: Open-Source Operating Systems Perspective. CRC Press.

This book is probably one of the best around. It details real-time system (and system software) concepts, but shines by gving FreeRTOS internal details, and also the internals of Real-Time extensions for Linux.

They have another book:

  • Bertolotti, Ivan Cibrario; Hu, Tingting. Embedded Software Development: The Open-Source Approach (Embedded Systems)

It is a bit different from the first. Keep the same theoretical approaches, but focuses heavily on development (not an RTOS, above and below) providing guidance on security, dependability and advanced usage of the GCC toolchain.

  • Real-Time Systems Development with RTEMS and Multicore Processors (Embedded Systems) (Blum, Cherril, Hu, Bertolotti)

Highly recommended. RT and OS theory and practice using the RTEMS as a platform. And it’s been for free on amazon kindle these days.

  • Buttazzo, Giorgio. Hard Real-Time Computing Systems: Predictable Scheduling Algorithms and Applications Springer Nature Switzerland.

Buttazzo is one of the top researchers on real-time scheduling. This book covers deep theoretical concepts on hard real-time scheduling, provides an overview of the internals of their hard RTOS (called DICK). Assess other RTOS (commercial, opensource or research) and standards (posix extension , osek, uTron, etc.) It is an advanced book.

  • Wang, K. C.. Embedded and Real-Time Operating Systems. Springer International Publishing.

Prof. Wang from WSU first wrote a book that was a tutorial on designing a UNIX-like operating system for x86-32, which he named MTX. This book is basically a port of the MTX, with some considerations for RTOS. His focus is on general-purpose embedded operating systems. He uses QEMU to emulate powerful processors such ARM926EJS and ARM Cortex A9MPCore for multiprocessor systems. There is a chapter using the TrustZone. (PS: code snippets on the book have some errors. You can email the author directly to get the source code)

  • Valvano, Jonathan. Embedded Systems: Real-Time Operating Systems for ARM Cortex-M Microcontrolers. Jonathan Valvano.

This book has a very a hands on approach and a good didatics. The book is not only about RTOS, it is self-contained, basically. It teaches you design a priority preemptive kernel for an ARM Cortex-M3, with synchronisation, communication, memory pools and even a file system. It also examines some internals of common RTOS for small devices. As the book covers too much, there’s more breadth than depth.

  • Marwedel, Peter. Embedded System Design: Embedded Systems Foundations of Cyber-Physical Systems, and the Internet of Things. Springer International Publishing.

Marwedel is one of the top researchers on embedded systems. This book is a very comprehensive compendium from hardware to software, targeting “Cyber-Physical Systems,” that is, embedded computers that regulate physical processes and ubiquitous computing. It covers hardware, modelling, system software, RTOS, verification, optimization, and testing. It is a free book; you can download it from the Springer site.

  • Laplante, Phillip A. Real-time systems design and analysis: tools for the practitioner. 4th ed.

A very interesting text given its breadth and practical insights. The RTOS chapter is not the best one.

  • Labrosse. uCOS-III – The Real-Time Kernel.

Depicts the internals of the uCOS-III kernel. Highly illustrated, and well-written. Now that the uCOS-III is open source, (https://github.com/weston-embedded/uC-OS3) the book can be read alongside the code, and you will learn a lot on RTOS design and implementation. The code is also a gem. There is the book on uCOS-II also.

  • Walls, Collins. RTOS: Design Insights and Implementation. Newnes

The book describes a stripped-down version of the Nucleus RTOS. His design approach is wise considering 8-bit CPUs, something to appreciate and be aware of. The book is very practical.

source code: colin-walls/NUSE (github.com)

  • Lacamera, Daniele. Embedded Systems Architecture: Design and write software for embedded devices to build safe and connected systems. Packt Publishing.

Probably one of the best books around. based on an ARM Cortex-M4., covers pretty much everything from scratch – from architecture patterns, boot-up, linking, drivers, multithreading and the Trusted Zone. It also depicts a small RTOS, with the bonus that it teaches you to use ARM MPU.

  • E. A. Lee and S. A. Seshia, Introduction to Embedded Systems- A Cyber-Physical Systems Approach, Second Edition, MIT Press, 2017

Edward Lee is another top researcher from Berkeley. He has very strong views on how we are ill-equipped for real-time systems design. He advocates that we do not have the right abstractions and semantics to model time on software. One of his strongest stances is that the thread model is flawed because it is highly indeterministic (he proves that mathematically in “The Problem with Threads“).

Now, this is a very formal book, with general RTE concepts with a critical approach. You can download it for free on the author’s page. Lee and Seshia, Introduction to Embedded Systems (berkeley.edu)

  • Pont, M. J. (2001). Patterns for time-triggered embedded systems: Building Reliable Applications with the 8051 Family of Microcontrollers. Addison-Wesley Longman.

It’s an old book here, but it has its value. Pont was a professor who now runs a company in the UK, TTE Systems, that specialises in safety-critical real-time embedded system software. He advocates “against” the preemptive priority model—and thus, the Rate-Monotonic Scheduling—saying the go-for approach is Time-Triggered cooperative patterns. Preemption is not needed—it hinders determinism and response time. Fine-grained cooperative tasks (co-routines) triggered by timers are the way to go. This book provides several TT design patterns, with the old 8051.

  • Kopetz, H., & Steiner, W. (2022). Real-Time systems. Design principles for distributed embedded applications

Kopetz’s way of thinking of real-time systems is totally worthy reading. Even if you are not going for time-triggered patterns, the structured and well thought approach he gives is exceptional.

  • Cooling, Jim. Real-time Operating Systems: Book 1 – The Theory (The engineering of real-time embedded systems)

This book provides shows what is an RTOS, its services, and when and why it is needed. Very informative.

His second book:

  • Cooling, Jim. Real-time Operating Systems: Book 2 – The Practice (The engineering of real-time embedded systems)

Teaches you techniques to design embedded software using well-known RTOS with an STM32F4 board.

PROGRAMMING

Well, you do need to know how to program a machine. A machine. Did I say a machine? Also you do need to understand algorithms and data structures. I stick with C because I almost can see what the compiler will be doing – this does not happens overnight though.

  • Lewis, Daniel. ARM Assembly for Embedded Applications: 5th edition

This book teaches ARMv7M (Thumb2) assembly, focusing on integrating it with C code.

  • Killie Loundon. Mastering Algorithms with C.

Personally, I do not know a good book that uses C to explain data structures and algorithms.

  • Allen B. Downey. The little book of Semaphores

Around 300+ pages, dealing with synchronisation issues. For free here: https://greenteapress.com/wp/semaphores/

  • Bruce Powel Douglass. Design Patterns for Embedded Systems in C

It is a handy guide with design patterns modelled in UML and snippets for embedded software, covering hardware access, concurrency, state machines, and safety.

  • K. C. Wang – Systems Programming in Unix/Linux

I am citing this book only because it has, in chapter 3, a conceptual multitasking system running within a Linux process. The author made that in order to explain multitasking. In summary, handmade threads. So, those who don’t know how to start will easily grasp context switching (x86-32), preemptive priority scheduling, and task synchronisation (sleep/wake). The remaining of the book is what is described in the title.

  • Preschern, Christopher. Fluent C: Principles, Practices, and Patterns. O’Reilly Media..

Plenty of interesting design patterns in C.

  • Zirkhov, Igor. Low-Level Programming.

Hardcore Assembly and C for x86-64.

  • Markstedter, Maria. Blue Fox: Arm Assembly Internals and Reverse Engineering. Wiley.

From the founder of azeria-labs, it covers ARMV8 (AARch64) assembly and reverse engineering binary files. The final chapter analyses a malware for MacOS.

  • Bryant. Computer Systems: A Programmer’s Perspective

A mix of computer architecture and systems programming.

  • Randall Hyde. The Art of Assembly Language, 2nd Edition

Assembly.

  • Richard Blum. Professional Assembly Language .

More asm.

  • Weir. Noble. Small Memory Software Patterns

Interesting. Curiously in C++.

  • Steve Oualline. Embedded C programming.

Excellent for beginners in embedded system software. I believe his older books on Practical C and Practical C++ still hold value.

  • Modern C: Jens Gustedt

Strictly talking about the C Language, this is an excellent reference for modern compiler features you can use in powerful machines. It will not teach you to program thinking on microcontrollers.

MISC

  • Pedro Mejia-Alvarez. Interrupt Handling Schemes in Operating Systems

A short 60 pages book detailing interrupt handling in several operating systems, including embedded. Very nice reading.

  • Rankl. Smart card Handbook

Only mentioning it here because it has a long chapter describing a smart card OS, probably the smallest and safest embedded OSes around.

  • David L. Parnas – On the Criteria to be Used in Decomposing Systems into Modules.

Well. It is Parnas.

  • Stevens, Myers, and Constantine. Structured design. IBM Systems Journal

1974 I guess it was one of the first papers to talk about coupling and cohesion.

Leave a Reply

Discover more from RK0 - Embedded Real-Time Kernel '0’

Subscribe now to keep reading and get access to the full archive.

Continue reading