Tuesday, May 29, 2018

Re: Limit CPU usage of a process?

There's https://man.openbsd.org/nice.1

You might be describing https://man.openbsd.org/setrlimit.2 or the
ulimit shell builtin (ulimit -t). But you might not want what you are
describing, if that is the case.

--
Raul


On Tue, May 29, 2018 at 2:35 PM, BergenBergen BergenBergen
<murk.fletcher@gmail.com> wrote:
> Browser or not, how *does* one cap CPU resources though? I think it's a
> very interesting question, and I'm sorta baffled by the fact that the
> demand for this kinda thing hasn't been any higher.
>
> All the best,
> Murk
>
> On Tue, May 29, 2018 at 8:10 PM, Dumitru Mișu Moldovan <dumol@l10n.ro>
> wrote:
>
>> On 05/27/18 13:07, Maximilian Pichler wrote:
>>
>>> Is it possible to limit the CPU usage of a given process to, say, 20%?
>>>
>>> I'd like to slow down the web browser since it is draining my laptop's
>>> battery. With enough tabs open it's often consuming ~50% of CPU but
>>> not doing anything productive. Apparently with RLIMIT_CPU in
>>> setrlimit(2) the total CPU time of a process can be limited. Can a
>>> similar limit be set for the percentage?
>>>
>>
>> Honest question… Have you tried blocking ads with something like uBlock
>> Origin? I use several approaches to make web browsing palatable on old
>> hardware, and blocking ads is what makes the biggest difference for me.
>> (Using NoScript or equivalents to selectively enable JavaScript for sites
>> where I actually need it is a distant second.)
>>
>> Capping CPU resources is not the way to go on a laptop in my opinion,
>> unless you have some demanding job that always runs in the background in
>> your browser, and that's a problem by itself in your scenario. Capping
>> will not change the fact that you'll still spend the same resources on
>> loading web pages, however it will slow you down and annoy you.
>>
>>

No comments:

Post a Comment