Learn R Programming

RAppArmor (version 1.0.0)

rlimit_rttime: Limit real-time cpu

Description

Specifies a limit (in microseconds) on the amount of CPU time that a process scheduled under a real-time scheduling policy may consume without making a blocking system call.

Usage

rlimit_rttime(hardlim, softlim = hardlim, pid = 0,
    verbose = FALSE)

Arguments

hardlim
time in microsec
softlim
time in microsec
pid
id of the target process
verbose
print some C output (TRUE/FALSE)

Details

Specifies a limit (in microseconds) on the amount of CPU time that a process scheduled under a real-time scheduling policy may consume without making a blocking system call. For the purpose of this limit, each time a process makes a blocking system call, the count of its consumed CPU time is reset to zero. The CPU time count is not reset if the process continues trying to use the CPU but is preempted, its time slice expires, or it calls sched_yield(2). Upon reaching the soft limit, the process is sent a SIGXCPU signal. If the process catches or ignores this signal and continues consuming CPU time, then SIGXCPU will be generated once each second until the hard limit is reached, at which point the process is sent a SIGKILL signal. The intended use of this limit is to stop a runaway real-time process from locking up the system.

References

Jeroen Ooms (2013). The RAppArmor Package: Enforcing Security Policies in {R} Using Dynamic Sandboxing on Linux. Journal of Statistical Software, 55(7), 1-34. http://www.jstatsoft.org/v55/i07/.

Ubuntu Manpage: getrlimit, setrlimit - get/set resource limits. http://manpages.ubuntu.com/manpages/precise/man2/getrlimit.2.html.

See Also

Other rlimit: rlimit_as, rlimit_core, rlimit_cpu, rlimit_data, rlimit_fsize, rlimit_memlock, rlimit_msgqueue, rlimit_nice, rlimit_nofile, rlimit_nproc, rlimit_rtprio, rlimit_sigpending, rlimit_stack

Examples

Run this code
#load lib
library(RAppArmor)

#current limit
rlimit_as();

#set hard limit
rlimit_as(1e9);

#set separate hard and soft limit. 
rlimit_as(1e9, 1e8);

#soft limits can be elevated
rlimit_as(soft = 1e7);
rlimit_as(soft = 1e9);

#set other limits
rlimit_core(1e9);
rlimit_data(1e9);
rlimit_fsize(1e9);
rlimit_memlock(10000);
rlimit_msgqueue(1e5);
rlimit_nofile(10);
rlimit_nproc(100);
rlimit_rttime(1e9);
rlimit_sigpending(1e4);
rlimit_stack(1000);
rlimit_cpu(60);

Run the code above in your browser using DataLab