Home

RLIMITCPU

RLIMIT_CPU is a per-process resource limit that constrains the amount of CPU time a process may consume. It is part of the POSIX resource limits interface (struct rlimit), and consists of two fields: rlim_cur (the soft limit) and rlim_max (the hard limit). Values are expressed in seconds; a value of RLIM_INFINITY indicates no limit. The timer measures CPU time spent in both user and kernel modes.

When a process uses CPU time beyond the soft limit, the kernel delivers a SIGXCPU signal to

Limits are set and queried via the setrlimit and getrlimit system calls. They apply to the process

RLIMIT_CPU is used to prevent runaway processes, enforce quotas, or isolate resource consumption in sandboxing or

See also: setrlimit, getrlimit, RLIMIT_AS, SIGXCPU.

the
process.
The
signal
may
be
caught
or
ignored;
if
the
process
continues
to
run,
CPU
time
continues
to
accumulate.
If
the
hard
limit
is
reached,
the
kernel
terminates
the
process,
typically
by
sending
a
SIGKILL.
and
may
apply
to
its
threads
depending
on
the
operating
system.
Many
shells
expose
the
soft
CPU
limit
via
ulimit
-t,
allowing
users
to
set
a
time-out
per
command.
job
control.
It
interacts
with
the
scheduling
and
signal
facilities
of
the
kernel,
and
may
be
combined
with
other
limits
such
as
RLIMIT_AS
or
RLIMIT_FSIZE
for
broader
containment.