[Nottingham] Opportunistically maximising resource utilisation

Camilo Mesias camilo at mesias.co.uk
Tue Sep 23 09:32:17 UTC 2008


Martin

> What might be the best strategy for an unprivileged low priority
> application to sense and opportunistically utilise spare resource such
> as idle CPU time and spare RAM and yet avoid (causing) excessive memory
> swaps or a system slow-down in any way?
>
> That is, how can you make a big resource hog really really nice and
> unobtrusive for whatever system?

Merely running with reduced priority will address the CPU time, I'm
not sure about RAM / swap.

> And also have the task gracefully kill itself if it has exceeded a
> certain CPU time or clock time without completion?

ulimit should do this.

> For example, I'm wanting something better than just looking at 'load
> average' because you can have a "high load" whilst the CPU is still 99%
> idle... And "nice 19" doesn't let a process tune itself for present
> conditions.

Well load average is just that - an average. I think the usual
approach is to set priorities and then let the processes run as fast
as the OS will let them. This ensures that the CPU is as busy as
possible. For raw CPU use this will be fine but it does get more
complicated if the processes contend for other resources - network or
disk access for example. It's much harder (at least in the embedded
Linux I've used) to prioritise disk access than CPU use.



More information about the Nottingham mailing list