Note that CPU time is not the same as elapsed time. If a
process is waiting/idle, it will not count towards the
CPU time limit. See the example for ?rlimit_cpu. Use the
'timeout' parameter in ?eval.secure to limit the total
elapsed time for a function call. Use rlimit_cpu only as a last-resort if-all-else-fails
method. When the cpu limit is hit, the kernel kills the
process without any warning. It is pretty much a ticking
timebomb that cannot be undone. When using eval.secure,
best practice is to make sure that the value for
rlimit_cpu is higher than timeout.
CPU time limit in seconds. When the process reaches the
soft limit, it is sent a SIGXCPU signal. The default
action for this signal is to terminate the process.
However, the signal can be caught, and the handler can
return control to the main program. If the process
continues to consume CPU time, it will be sent SIGXCPU
once per second until the hard limit is reached, at which
time it is sent SIGKILL. (This latter point describes
Linux behavior. Implementations vary in how they treat
rocesses which continue to consume CPU time after
reaching the soft limit. Portable applications that need
to catch this signal should perform an orderly
termination upon first receipt of SIGXCPU.)