24

I am a little concerned with the amount of resources that I can use in a shared machine. Is there any way to test if the administrator has a limit in the amount of resources that I can use? And if does, to make a more complete question, how can I set up such limit?

Walery Strauch
  • 6,792
  • 8
  • 50
  • 57
Eduardo
  • 19,928
  • 23
  • 65
  • 73

3 Answers3

18

For process related limits, you can have a look in /etc/security/limits.conf (read the comments in the file, use google or use man limits.conf for more information). And as jpalecek points out, you may use ulimit -a to see (and possibly modify) all such limits currently in effect.

You can use the command quota to see if a disk quota is in effect.

matli
  • 27,922
  • 6
  • 37
  • 37
  • All the inputs are commented,does that mean that there is no limit?. – Eduardo Jan 12 '09 at 23:31
  • Most probably, at least regarding CPU and memory usage. For disk usage I think you will need to check with the quota command – matli Jan 12 '09 at 23:34
11

You can try running

ulimit -a

to see what resource limits are in effect. Also, if you are allowed to change such limits, you can change them by the ulimit command, eg.

ulimit -c unlimited

lifts any limit for a size of a core file a process can make.

jpalecek
  • 47,058
  • 7
  • 102
  • 144
  • 2
    I realize this question is 3 years old, but the man page lists this program as being obsolete (says use `getrlimit` instead) – puk Apr 17 '12 at 08:25
  • 1
    The ulimit() C library function is (see [ulimit(3)](http://man7.org/linux/man-pages/man3/ulimit.3.html)), the shell builtin is not (see [bash(1)](http://www.gnu.org/software/bash/manual/bashref.html#Bash-Builtin-Commands)). – remram Mar 07 '14 at 18:22
1

At the C level, the relevant functions (actually syscalls(2)...) could be setrlimit(2) and setpriority(2) and sched_setattr(2). You probably would want them to be called from your shell.

See also proc(5) -and try cat /proc/self/limits and sched(7).

You may want to use the renice(1) command.

If you run a long-lasting program (for several hours) not requiring user interaction, you could consider using some batch processing. Some Linux systems have a batch or at command.

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547