# CPU Quota

## Uzytkownik

Is there any article how to set up CPU quota? Does it need patched kernel?

----------

## disi

I had a look here which is probably what you are looking for.

Can't find information about when this was intruduced  :Smile:  But should be in the kernel.

----------

## Uzytkownik

Thanks - but it is not something I was looking for. It limits the process to the single single processor (or core) - but I need to limit a process to for example 20% of CPU time on single processor-single core system.

----------

## coolsnowmen

For my own edification. What problem are you trying to solve that nice & ionice don't solve for you?

If I really wanted to do it here are two ways.

You could watch the (cputime a process is utilizing) / (actual time) and when it exceeded x% over delta_t you could send the stop/resume signals to throttle it.

Internal throttling using simple sleeps, or setrlimit.  setrlimit might require it to be a privileged process though.

----------

## Uzytkownik

 *coolsnowmen wrote:*   

> For my own edification. What problem are you trying to solve that nice & ionice don't solve for you?

 

Heat and power cosumption  :Wink: 

 *coolsnowmen wrote:*   

> If I really wanted to do it here are two ways.
> 
> You could watch the (cputime a process is utilizing) / (actual time) and when it exceeded x% over delta_t you could send the stop/resume signals to throttle it.
> 
> Internal throttling using simple sleeps, or setrlimit.  setrlimit might require it to be a privileged process though.

 

Thanks. I'll think.

----------

## coolsnowmen

 *Uzytkownik wrote:*   

>  *coolsnowmen wrote:*   For my own edification. What problem are you trying to solve that nice & ionice don't solve for you? 
> 
> Heat and power cosumption[sic] 
> 
> 

 

What is this process doing? For absolute heat and W*h savings, you want to finish a task as fast as possible, and then turn your computer off (sleep to ram for speed).

As far as technical terms go, I believe you are much more interested in throttling than quotas. Along those lines, you would be best served making sure you have a cpu with multiple power states, and using a conservative governor.

----------

## Gambit89

How about cpulimit?  I've only had to use it for some program on wine that took 100% cpu; bringing it down didn't affect the program's performance at all.  Otherwise, the ondemand governor works for me to save power and generate less heat.

----------

## coolsnowmen

 *Gambit89 wrote:*   

> How about cpulimit?  I've only had to use it for some program on wine that took 100% cpu; bringing it down didn't affect the program's performance at all.  Otherwise, the ondemand governor works for me to save power and generate less heat.

 

haha, it does exactly what one of my suggestions was.

----------

## Uzytkownik

 *coolsnowmen wrote:*   

>  *Uzytkownik wrote:*    *coolsnowmen wrote:*   For my own edification. What problem are you trying to solve that nice & ionice don't solve for you? 
> 
> Heat and power cosumption[sic] 
> 
>  
> ...

 

Well. Not exactly.

1. With regard to the heat - I have an overheating laptop. After patching it works  better but it still suffers from overheating. Possibly I'd like to have compilations (and may be someting like boinc) during night without being woken up by fan. Reducing it to let's say 50% would have big inpact on heat but it will not affect desktop applications/

2. Sometimes I run short periods on battery (short mainly as it is old). Having compilation in background with low level will enlonger battery life. Of course - I may use SIGSTOP/SIGCONT but this way it is much more convinient.

 *coolsnowmen wrote:*   

>  far as technical terms go, I believe you are much more interested in throttling than quotas. Along those lines, you would be best served making sure you have a cpu with multiple power states, and using a conservative governor.

 

I don't have (it is Celeron M). Or rather - it is more complicated story then this (i.e. it can have it somehow emulated but while I'm interested in slowing down compilation - I'm not interested in slowing down whole system. And compilation even on 20 is gready so it occupies 100% of CPU, heats it and slow downs the computer).

----------

## coolsnowmen

Ahhh, the old laptop problem, thank you for humoring me with an explaination

I hope cpulimit works to your liking

----------

## Uzytkownik

 *coolsnowmen wrote:*   

> Ahhh, the old laptop problem, thank you for humoring me with an explaination
> 
> I hope cpulimit works to your liking

 

What's so humoring about it?

PS. Yes - from cpulimit home page it seems it is ok. I was misguided by the first page given (which described only per-cpu settings).

----------

## coolsnowmen

 *Uzytkownik wrote:*   

> What's so humoring about it?

 

It is a "turn of phrase". Where are you from?  

It means: to go along with the other person despite your own want to. As if it were simply to make me happy.  It has nothing to do with actually being funny.

----------

## Uzytkownik

 *coolsnowmen wrote:*   

>  *Uzytkownik wrote:*   What's so humoring about it? 
> 
> It is a "turn of phrase". Where are you from?  
> 
> It means: to go along with the other person despite your own want to. As if it were simply to make me happy.  It has nothing to do with actually being funny.

 

I'm non-native speaker. Well. Yet another false-friend word to collection I guess.

----------

