[systemd-devel] make systemd service takes cpu exclusively

Cao, XinX xinx.cao at intel.com
Mon Nov 17 22:25:43 PST 2014


Hi, Umut  & David,
	
	My project needs the Graphical desktop to display on monitor as fast as possible, but I found lots of unrelated services( such as sound, network, ... ) are competing CPU even they are explicitly After graphical service. And this competion delays the startup of graphical desktop process. So, my opinion is to make graphical related programs runs first and  the other unrelated services only starts after graphical program finished startup. I will check " StartupCPUShares=" this item and I hope it's helpful for me.

Thanks

-----Original Message-----
From: Umut Tezduyar Lindskog [mailto:umut at tezduyar.com] 
Sent: Monday, November 17, 2014 17:51
To: Cao, XinX
Cc: systemd-devel at lists.freedesktop.org
Subject: Re: [systemd-devel] make systemd service takes cpu exclusively

Hi XinX

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.

What exactly is the problem when they all want to get the CPU?

>
>
>
>             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.

It really depends on your use case and what you consider with "a.service runs first".

If you only want to start the service first, then you can always add After=a.service directive to other services that are starting at the same time. But this is pretty static information. You have to do this for every time you change your priority service.

You could also prioritize a service by changing their StartupCPUShares= but this is not truly stopping other services from being scheduled in. Maybe they get the minimum CPU, but they still do.

Lennart has recently considered to change the startup queue to prioritized startup queue where a prioritized service will be forked off before other services - http://lists.freedesktop.org/archives/systemd-devel/2014-October/024315.html.

Umut

>
>
>
>             Thanks~
>
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>


More information about the systemd-devel mailing list