Resource Limits Architecture

Jordan Mendelson (jordy@wserv.com)
Thu, 16 Sep 1999 05:05:12 -0400


A few days ago I mentioned that robust resource limits really didn't exist in
Linux. Alan Cox (who I thought moved to the US, but uses a UK email address)
mentioned

ftp://ftp.nc.orc.ru/pub/Linux/people/saw/kernel/userbean.5

which appears to be a good start for resource limits, however I still don't
find it robust enough.

I have searched high and low and can't find a good complete resource limits
architecture in any Unix implementation. As I see it, there should be a few
different categories of limits:

Per-System : Limits which are placed on all processes
Per-Group : Limits which are placed on all processes from a group id
Per-User : Limits which are placed on all processes from a user id
Per-Process Group : Limits which are placed on a group of processes (shared)
Per-Process : Limits which are placed on a process
Per-Thread Group : Limits which are placed on a group of threads (shared)
Per-Thread : Limits which are placed on a thread

Now of course, these will overlap since a thread is part of a process which
has a user id a group id and runs on a system. The accepted semantics of the
most generalized type being the upper limit of the more specific type should
work fine, so:

Per-Thread's hard limit is Per-Thread-Group
Per-Thread-Group's hard limit is Per-Process
Per-Process's hard limit is Per-Process-Group
Per-Process-Group's hard limit is Per-User
Per-User's hard limit is Per-Group (if mult groups, lowest would be hard
limit)
Per-Group's hard limit would be Per-System
Per-System's hard limit would be the kernel's upper limit

The commercial unices I've seen really only do per-user, per-process,
per-thread and per-system which is probably adequate most of the time.

A lot of resources themselves overlap as well. So the hard limit of network
buffers would be total memory.

There are of course some resource limits which I'd love to see implemented:

Wall clock time - Time in seconds the process has physically ran, current time
- start time. As far as I know, the only time related resource limit is CPU
time which only measures time in the run state.

Number of CPUs - Processes/Threads will be restricted to use a maximum of x
cpus. This would be a great thing for a per-group limit, you could set users
in group 'cpuhogs' to a maximum of 2 CPUs and the rest of the system to 4
CPUs.

Disk Space - Sure would be nice if this was all handled by a single interface.
Right now we have a separate quota interface, I'm not sure how feasible it is
to have disk space limits settable by the same interface as other things.

Is this a bit of an overkill?

Are there any unices or other OS's which implement these types of resource
limits?

Just curious,

Jordan

--
Jordan Mendelson     : http://jordy.wserv.com
Web Services, Inc.   : http://www.wserv.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/