Difference between revisions of "Resource Limits on the Linux Clients"

Line 5: Line 5:
 
== Memory Usage ==
 
== Memory Usage ==
  
The maximum memory (RAM) usage for a program is '''2 GiB'''.
+
The maximum memory (RAM) usage for a program is '''4 GiB'''.
  
Note that this limit applies collectively to every program started from the ''same'' login session.  Running one program that uses 2 GiB of RAM will hit the limit, but so will running four programs that each use 512 MiB of RAM.
+
Note that this limit applies collectively to every program started from the ''same'' login session.  Running one program that uses 4 GiB of RAM will hit the limit, but so will running eight programs that each use 512 MiB of RAM.
  
 
When your program hits the memory limit, any further attempts to allocate memory will fail.  How that failure is manifested will depend on your programming language.  In C, <code>malloc()</code> (or another memory allocation function) will return <code>NULL</code> and <code>errno</code> will be set to <code>ENOMEM</code>.  In Python, a <code>MemoryError</code> exception will be raised.  In Java, an <code>OutOfMemoryError</code> will be raised.  For other languages, please consult the relevant documentation.
 
When your program hits the memory limit, any further attempts to allocate memory will fail.  How that failure is manifested will depend on your programming language.  In C, <code>malloc()</code> (or another memory allocation function) will return <code>NULL</code> and <code>errno</code> will be set to <code>ENOMEM</code>.  In Python, a <code>MemoryError</code> exception will be raised.  In Java, an <code>OutOfMemoryError</code> will be raised.  For other languages, please consult the relevant documentation.

Revision as of 15:34, 22 August 2023

Our undergraduate Linux clients have system-enforced limits on some programs' resource usage. These limits are designed to prevent runaway programs from impacting other people's use of the shared computers. The limits should not affect your routine use of the systems; if you believe they're causing problems, please contact us to discuss the issue.

For some guidance on not exceeding these limits, please see our page on Preventing Your Programs From Overrunning Our Computers.

Memory Usage

The maximum memory (RAM) usage for a program is 4 GiB.

Note that this limit applies collectively to every program started from the same login session. Running one program that uses 4 GiB of RAM will hit the limit, but so will running eight programs that each use 512 MiB of RAM.

When your program hits the memory limit, any further attempts to allocate memory will fail. How that failure is manifested will depend on your programming language. In C, malloc() (or another memory allocation function) will return NULL and errno will be set to ENOMEM. In Python, a MemoryError exception will be raised. In Java, an OutOfMemoryError will be raised. For other languages, please consult the relevant documentation.

Number of Processes

We have a limit of 1024 processes per login session.

Note that this limit applies to processes, not threads. We do not currently have a limit on number of threads per login session, though we might revisit this setting in the future if need arises.

If the total number of running processes started from the same login session is at the limit, attempts to start any additional processes will fail. How that failure is manifested will depend on the program that tried to launch the additional process. In C, fork() will return -1 and errno will be set to EAGAIN. A shell will typically give a message along the lines of "fork failed: Resource temporarily unavailable". In Python, you will typically get a BlockingIOError with a message of "[Errno 11] Resource temporarily unavailable". The Java exception raised will vary depending on the function having been called; for instance, java.util.concurrent.ForkJoinPool.execute() will raise java.util.concurrent.RejectedExecutionException.

Maximum Process Runtime

Any program that has consumed more than 1 week of accumulated CPU time will be terminated.

"Accumulated CPU time" is the total amount of time spent actively using a single CPU core. For example, a single-threaded process running continuously for one week will accumulate one week of CPU time. Along the same lines, a process with seven threads, all running continuously, will accumulate seven seconds of CPU time for every actual elapsed second and, therefore, will accumulate one week of CPU time after running for one day.

When a program exceeds the CPU time limit, it will be sent the SIGXCPU signal. If the program has no registered handler for that signal, it will simply stop running and its parent process will be notified. If it has a registered signal handler, the handler will be given about 30 seconds of runtime to clean up any resources before the process is ended. The process will be sent a new SIGXCPU signal every second until it exits. If it's still running after 30 seconds, the process will be forcibly terminated.

Disk Usage

Ugrad systems are also subject to disk usage limits, as described on the Disk Quotas page.

If your disk usage is at its limit, attempts to write additional data to files in the /home filesystem will fail. In C, the write() function will return -1 and errno will be set to EDQUOT (or, in some cases, ENOSPC). Python will raise an OSError exception with message "[Errno 122] Disk quota exceeded". Java might not raise an exception and instead might just silently fail to write the data.