The key word here is resource. A resource error when trying to execute a command is likely the result of too many user processes. To prevent fork bombs on a machine that supports many users, the maximum number of processes a user can simultaneously run is thirty (30) but a warning will be issued at twenty (20). This is generally not a problem since only four simultaneous logins are allowed for each user, but it does occasionally happen. The cause is usually background or stopped processes, and occasionally something more troublesome such as runaway processes. In any event, the solution is to identify the other processes and terminate them. See Process Control, below, for information on identifying and terminating processes.
"There are stopped jobs"
This error, seen when logging out, means that there are suspended processes that should be properly terminated before logging out. It is still possible to logoff by typing the command exit twice, but the suspended processes may not terminate gracefully. The recommendation is that all suspended processes be properly terminated before logging off. See Process Control and CTRL-Z, below, for more information on suspended processes.
Often a source of problems for Windows users, this key command immediately stops (but does not terminate) the running process and returns the user to the command prompt. It is deceptive in that it appears that the previous process was terminated when it was not - it was merely stopped and is in a wait-state. Stopped commands or jobs can be viewed with the
jobs command. A common mistake is to type CTRL-Z from inside of an editor like emacs and then start another editing session (the proper way to exit emacs is CTRL-X,CTRL-C). Stopped processes may be brought back to the foreground with the fg command.
Unlike the Windows copy command, CTRL-C in Linux is used to immediately terminate the current process.
This section is not meant to be all inclusive, nor a tutorial on Linux processes. It is intended to assist students who are getting resource errors or stopped job errors. Instructors and/or the CSAC should be consulted for more thorough assistance.
It is important to understand that Linux processes may be stopped, running in the background, or running in the foreground. This is very similar to Windows or Macs except an ssh session does not present a graphical interface to easily see all processes. To use Windows or OS X as an analogy, stopped processes may be thought of as open windows on the desktop or task bar that have been started but are not currently in use. Backgound processes are actually doing something but do not require any immediate attention, such as checking for software updates. Foreground processes are currently in use. An active browser or editor is a good example of a foreground process.
A primary source of confusion and problems using Linux is that users forget about stopped and background processes. To see all processes, the
ps command is used with the -u switch and the user id:
> ps -u user1234
PID TTY TIME CMD
7538 ? 00:00:00 sshd
7539 pts/2 00:00:00 bash
7639 pts/2 00:00:00 emacs-x
8180 pts/2 00:00:00 ps
Here, the ssh session, the shell (bash) an emacs session and the current command (ps) are all shown. Since ps was the last command, the emacs session may be stopped and might cause a "stopped jobs" error on logout. To see if it is suspended, use the jobs command:
+ Stopped emacs
This confirms that emacs is stopped, probably because CTRL-Z was typed. Because emacs is an editor, logging off without properly saving and quitting may result in loss of any unsaved work. The best way to finish the emacs session is to return it to the foreground with the
fg command, save any work, and exit with the proper commands (CTRL-X, CTRL-C). These same steps allows a user to stop any processes that might be causing resouce allocation errors. In the event of resource allocation errors, large number of processes usually appear in the ps listing, above.
Compiling and running Java programs. You should specify memory requirements for java and javac on the command-line. For example, to compile a HelloWorld program, a small memory pool will work:
> javac -J-Xmx5m HelloWorld.java
To run the program you will probably also need to specify memory limits:
> java -Xmx512m -Xms512m HelloWorld