How can I monitor what is going on with my Linux system?

You may have to install this tool called dstat, but then run:

dstat -tcndylp –top-cpu

This will list a snapshot of system behavior every second which can tell you if your CPUs are pegged, memory usage is maxed, or if IO is getting hammered. All very important for understanding why a system might be behaving strangely.

You can also use the following when you run you program to cross-correlate STDOUT messages to resource utilization to:

my_program -arg 123 | awk ‘{ print strftime(“%Y-%m-%d %H:%M:%S”), $0; fflush(); }’