runlim is a command-line utility that enables users to limit the time and memory usage of a program and its child processes using the proc file system on Linux. The utility works by setting up resource limits on the proc file system for a process or a group of processes, and then executing the process within these limits.
The runlim utility supports various options that allow users to specify the limits for time, memory, and other resources. For example, the -t option is used to set a time limit for the process, while the -m option is used to set a memory limit.
The runlim utility also supports various other options for configuring the limits and monitoring the process. For example, the -s option can be used to specify the soft limit for a resource, which allows the process to exceed the limit for a short period before being terminated. The -o option can be used to specify a file where the output of the program will be redirected.
If you encounter the below error while running the command runlim:
runlim: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install runlim |
Ubuntu | apt-get install runlim |
Kali Linux | apt-get install runlim |
Raspbian | apt-get install runlim |
runlim Command Examples
1. Print the time and memory usage of a command:
# runlim command command_arguments
2. Log statistics to a file instead of stdout:
# runlim --output-file=path/to/file command command_arguments
3. Limit time to an upper bound (in seconds):
# runlim --time-limit=number command command_arguments
4. Limit real-time to an upper bound (in seconds):
# runlim --real-time-limit=number command command_arguments
5. Limit space to an upper bound (in MB):
# runlim --space-limit=number command command_arguments
Summary
Overall, runlim is a useful tool for ensuring that a program and its child processes do not consume excessive resources on a Linux system, which can help prevent performance issues and system crashes. More information about runlim can be found on the official website for the tool, http://fmv.jku.at/runlim.