On Thursday, January 10, 2002, at 12:04 PM, Jim Wilcoxson wrote:
> It would be really cool if there were a way to set a CPU and/or real
> time limit for scripts from inside the script, and invoke a proc
> with args or something, like a signal handler.

For hosting, I really wanted to be able to use the rlimit facilities to
limit CPU use, but the problem is that rlimit sets per-process limits, and
AOLserver is thread-based.  What I usually want is to limit the CPU time
allowed per-response, but there's no OS-enforceable way to do this without
involving all the threads.  Back when virtual hosting was part of
AOLserver, that would have been unacceptable.

If using rlimit is acceptable for you, the "limit" command in some shells
can set a per-process CPU time limit, or you can write a wrapper for
AOLserver that calls rlimit before exec-ing AOLserver.

In fact, rlimit will deliver a signal to the process when you exceed the
soft CPU limit, but it seems to me that you can only contract your CPU
limit, you can't expand it, so you couldn't set a recurring limit for
requests.

Next operating system I write will have per-thread resource controls!

Reply via email to