Preventing Your Programs From Overrunning Our Computers

INTRO

As part of being a Computer Science student, you will no doubt create and run your own programs on our CS Linux Systems You also might be downloading programs from elsewhere and running then on our systems as well.
It's possible that software you write (or software you've downloaded and run) could, when running, exceed the existing resources on our systems.

Computing System Resources That Could Be Exceeded

  • Memory (RAM)
  • CPU (processing power)
  • Disk space
    • Ugrad Net users have a disk quota to prevent that.
    • Grad/Research Net users do not have specific disk quotas but must realize that they share their disk space with faculty, staff, etc. So, they must pay close attention to the disk space they use.
    • Disk space not only included your home directory, but can also include your use of the Linux systems's /tmp directory as well.

Typical Symptoms Of Exceeding Computer Resources On Our Linux Systems

  • Timeouts ssh'ing into the computer.
  • Programs run much slower than usual
  • Programs stop running because they run out of RAM or swap disk space.

Who Is Affected When Your Program Uses Up Resources On One Of Our Linux Systems?

Because all our our CS Linux computers are multiuser systems, programs that exceed the computer's resources, slowing down the system, could potentially affect all the users logged into those systems, remotely, or at the actual computer console.
Exceeding the computer's resources could also affect programs running in the background, perhaps as part of the computer's own system software or other users' batch jobs.
So... always be aware that you are not necessarily the only one logged into a system when you're running your own programs.

Tips To Prevent Your Programs From Exceeding The System Resources On Our Computers

  • Try to avoid using the system's complete RAM memory as much as possible. Put safeguards into your programs to monitor your use of memory.
  • Try to run your programs during low-demand times of day (mornings are best; late evenings are the most busy.)
  • Try not to tie up the computer's resources for longer than the program needs to run.
Do not forget that you are running programs. One of the biggest areas we've had issues with is that some users start their programs in the background and forget that the programs are still running. And in some cases, the programs have issues and start using more resources than actually needed.
Therefore... please make sure you check in on your running programs often, and use monitoring tools to make sure you are not exceeding resources.

Monitoring Your Processes' Memory and CPU Usage With Linux Commands

Use the top or htop programs to see your program's stats.
  • top
    • top -u username
  • htop
    • htop -u username
    • htop --user=username
  • ps (coming soon)

Ending Or Modifying Your Running Process Using Linux Commands

Ending A Process

  • kill - end a process
    • First, determine process ID (PID)
    • Generally best to choose the ___ kill signal
      • Example: Kill process with PID 15476 using kill signal _____:
        • kill -____ 15476
  • pkill - end a process
    • First, determine process ID (PID)
    • Determine appropropriate kill signal
      • Example: to kill all processes owned by you (with your username being csstar)
        • pkill -9 -u csstar (this example will also kill your logged-in shell process.)
  • Within top command
    • Find desired process ID (PID)
    • press k (for kill)
    • enter PID at prompt.
    • enter kill signal

Modifying A Process's Running Priority

  • nice - modify a process's running priority

And, Worth Mentioning Again...

Please remember that because these are multiuser systems, other users could be logged into the system and could be affected if your running program exceeds the computer's resources.