29.07.2025 11:30, Marc Haber 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.


It is unclear what you want

Serialize template instances?
Serialize "independent services"?
Serialize any instance of template service and any of the independent services? Everything together (serialize every template instance and every independent service in any combination)?

Serializing template instances will be tough call without the mentioned future option unless you can enumerate all possible instances and add explicit After/Before. If the set of instances is static for a given boot generator could automate it.

For other cases After/Before should work.

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


Reply via email to