Skip to main content

Designing Fibers for systemd: Structured POSIX Avoidance in PID 1

UD6.215 | Day 1 | 11:50 - 12:15 | Speakers: Daan De Meyer

Designing Fibers for systemd: Structured POSIX Avoidance in PID 1
A picture of a devroom at FOSDEM 2024
Open in browser

Notes

Abstract

Concurrency in pid 1 and systemd in general is a touchy subject. systemd is very trigger happy when it comes to forking and when combined with multithreading this causes all sorts of issues, so there's an unwritten policy to not use threads in systemd. This has lead to (in my opinion) a sprawling callback hell in every daemon and CLI in the project that performs concurrent operations.

In this presentation I'll present my view on the issues with using threads in systemd and why cooperative multitasking implemented using green threads can fix many of them while avoiding callback hell. I'll also briefly go over the unique problems you run into when designing a fiber based system in and the general design for fibers in systemd, finishing with how they're implemented under the hood with ucontext.h.

I'm hoping to get feedback on the approach from the devroom, and bring awareness on how systemd is using the GNU toolchain.

https://github.com/systemd/systemd https://github.com/systemd/systemd/pull/39771

Attachments


Notice: The placeholder video image is licensed under CC BY-SA 4.0. The original image can be found hereChanges made to the image are: Cropped the image to a new ratio, part of the image was cut off.