Agenda: (Linux) Systems Programming With C++#
Three days of systems programming, interwoven with select C++ topics.
(Linux) Systems Programming#
This is probably a bit too much for a three day course to present in detail; lets see what can be omitted.
Basics
Processes. Can be reduced to a minimum. Zephyr does not have processes, at least not the Linux way.
Signals. Is there such a thing on Zephyr?
Time, Clocks, Timers And Notification. Core topic is that timers add weird notification features that add multiple dimensions of complexity. How’s that on Zephyr?
Hardware interfaces: GPIO (
libgpiod), I2C, SPI, PWM, HWMON. This has nothing to do with Zephyr.Event loops:
select(),poll(),epoll()Maybe have a short look into Python’s
asyncioframework. Maybe only after we have looked into threading.
Memory Management/mmap(). Can Zephyr use an MMU, and how?
Scheduling and realtime, and priority inversion. Fun: Legendary: The Mars Pathfinder Incident
IPC: message queues, POSIX shared memory, POSIX semaphores. How’s that on Zephyr? Inter Process Communication without processes
Multithreading; cover POSIX threads and C++ threads in parallel
POSIX threads, vs. C++ threads
C++ memory model Very good a-ha
POSIX mutexes vs. C++ mutexes and scoped locking
POSIX condition variables vs. C++ condition variables and C++ promise/future
C++#
Don’t present explain basics like range-for, or auto, or Tuple Unpacking (Err, Structured Binding) - just use them in live-hacking sessions. Likewise, stay away from niche/advanced features like coroutines, or “deducing this”.
Proposed topics (apart from those already touched during Systems Programming) …
Smart Pointers: std::unique_ptr, std::shared_ptr (And std::weak_ptr) (
std::unique_ptrusage requires a bit of move-understanding, so this is a good intro)The Rule Of Three/Five/Zero, including move. There is a separate slide deck on move here.
Show creative
autousage: Abbreviated function templates