Originally posted by nasyt
View Post
So you see, these days I'm using Linux in embedded designs. Because it allows me to take a decent system meant for real world fast, get all features I'm used to, and then achieve my goals in relatively painless ways and sane time frame. No royalty crap, no need to be super-huge-corp to complete task, etc. Just great.
As of systemd: systemd is one of those things that make linux unsuitable for embedded,
Yet, it turned out systemd can offer a lot of goodies here.
1) Adequate handling of failed services. One can select what to do if critical service fails, which makes recovery easier.
2) Systemd can easily set up all stuff I need, be it realtime priority, OOM score, resource limits, priveleges, or whatver one can imagine related to process management. Say, I have "critical" events handler process, which is lightweight but MUST respond fast, otherwise it can miss real-world events, which is unacceptable. Then I have "background" process which does "heavy lifting" and is not time critical at all. With systemd I can configure all this as matter of few lines of config. The only alternate option would be to code my very own process starter, capable of about 70% systemd can do. Which is pointless waste of time once there is systemd.
3) Systemd is aware what watchdog is.
4) Systemd goes even further - you can have "watchdog tree". Systemd serves main hardware watchdog to prove it alive. Then it monitors processes who could be set up to report they're alive to systemd. And this facility saves me heck a lot of coding and reinventing wheels. Sure, I can code system monitoring and "mission control" stuff myself. But it would take me a lot of time and it is a big question if I can do it better. And how much features I'll have to add on the way.
5) If something goes wrong, systemd can, say invoke my handler so I can try to deal with issue.
6) If this fails as well, systemd can, say, force-reboot system without human supervision when some absolutely critical part has failed. And you can also set up OOM scoring, priority, IO priority and so on - "must have" for sensitive tasks.
7) If systemd fails as well, hardware watchdog would give hardware reboot. So it's a "watchdog tree". Sure, one have to patch their program a bit to deal with systemd's watchdog facility. But it only takes few lines of code, much less than coding comparable facility yourself.
In fact I'm really not in mood to rewrite of half of systemd myself to create "mission control", etc. Systemd already got reasonable at that. Maybe its not perfect, but it can save a day on many occasions. After all, RedHat is inclined on enterprises and they have serious requirements about reliability, autonomous operations and somesuch. Servers are somewhat similar to embedded in this regard. Nobody want to pay attentio to servers - they supposed to run with little to no supervision. Like embedded systems do. And systmed is quite configurable. I.e. if you're short on resources, you can chop many systemd components you do not need in particular task out of the way.
because systemd is anything but lightweight.
Systemd may be suited for desktop PCs or Laptops, where i have a reset button i can press, if systemd hangs up the system.
Absolutely wrong, aside bare-metal applications (those without kernel or OS), there are many real-time operating systems and microkernels around. The most secure Handy uses an L4 microkernel. There are also Microcontrollers, Linux cant run on, 8- and 16 bit for example.
Yet, Linux is "relatively large" for microcntrollers and not really meant for "hard realtime". So it haves its limits. Yet, below these limits people usually use either no OS at all (bare metal, single task) or some small RTOS things like FreeRTOS. And these plan9 and L4 are mostly theoretic. They're theoretically sound... but good luck to ACTUALLY USE them. Come on. Show some actual devices runing them.
Comment