Monday, August 23, 2010
controlling cpu usage part 2: CPU Usage Limit in the Shell
The shell ulimit command can be used to check or set the CPU limit for any subsequently created children, and their descendants. The -t option to ulimit sets the amount of CPU time a process may use before it is sent a SIGXCPU signal by the kernel. The default is unlimited (maximum CPU time).
# su - useruser $ ulimit -t
unlimited
user $ sh
user $ ulimit -t
unlimited
user $ ulimit -t 10
user $ date; while : ; do : ; done; date
Friday, 5 September 2008 3:34:56 PM EST
Cpu Limit Exceeded (core dumped)
user $
# su - useruser $ ulimit -t
unlimited
user $ sh
user $ ulimit -t
unlimited
user $ ulimit -t 10
user $ date; while : ; do : ; done; date
Friday, 5 September 2008 3:34:56 PM EST
Cpu Limit Exceeded (core dumped)
user $
Labels:
Performance,
Tuning
No comments:
Post a Comment