On Tue, 29 Jul 2025 at 11:00, Marc Haber <mh+systemd-de...@zugschlus.de> wrote: > > Hi, > > I have a template service unit which runs a oneshot service that > generates both high CPU and high I/O load for a couple of minutes. The > service is templated a couple of times and runs from an, also templated > timer. > > In another use case, I have independent services that generate high CPU > and high I/O. > > In both cases, it has been measured that total processing time is > quicker when one lets the jobs run one after the other instead of having > them conurrently compete over same set of resources. The measurement > results are even more clear when the data is stored on HDDs due to head > movement and disk rotation latency. > > I would like to lock them against each other that only one of those > services runs concurrently at a time, and other instances that might > have been requested while one is still running are delayed until > everyhing is "free". Missing a job because one other is already running > would be a bug. > > The solution one finds on the net is to use flock(1) in the ExecStart* > options, often making wrapper scripts necessary. I find this clumsy and > un-systemd-like and would not like to do that. > > Does systemd offer a better solution for this? > > Greetings > Marc
https://www.freedesktop.org/software/systemd/man/devel/systemd.slice.html#ConcurrencySoftMax=