[systemd-devel] make systemd service takes cpu exclusively

David Herrmann dh.herrmann at gmail.com
Mon Nov 17 01:39:22 PST 2014


Hi

On Mon, Nov 17, 2014 at 9:40 AM, Cao, XinX <xinx.cao at intel.com> wrote:
> Hi, everybody,
>
>
>
>             As we all know that currently systemd puts all the services into
> a run_queue, and lets them run together as possible as it can. However, this
> mechanism also brings in a problem, which means all the services will
> contend for CPU, and systemd is unable to make sure one service has priority
> ONE  and only itself takes the CPU when this service is starting.
>
>
>
>             For example, if we want to make sure a.service runs firstly ,
> and all the other services runs after  a.service is finished.
>
>
>
>             So, does anybody know if systemd has this kind of mechanism?  If
> not, can we create a way to do this and add this feature into systemd? Or
> is this idea possible?  I think this is very usefull under some situations.

You could use explicit ordering (see Before= and After=) to make your
unit run almost exclusively. But this will cause a significant
bottle-neck during boot and is not recommended at all. The question
really is _why_ you want that unit to be run before anything else.

If you only want to prioritize one unit, have a look at "man
systemd.resource-control". It provides a huge set of options to
configure your units. You have quite fine control over CPU shares etc.
Specifically the StartupCPUShares= option might be of interest to you.

Thanks
David


More information about the systemd-devel mailing list