If you use GNU Parallel for running memory hungry programs, you will
probably appreciate --noswap:
parallel --noswap your_memory_hungry_program ::: a b c
This will run your_memory_hungry_program unless your system is
swapping both in and out - which is usually an indication that your
system is out of physical memory. It will test every 10 seconds and
try again then.
If you use GNU niceload for running memory hungry programs, you will
probably appreciate --noswap, --mem, and --hard:
niceload --hard --load 2 your_cpu_hungry_program
niceload will normally slow down a program, but with --hard it will
suspend the program until the limit is reached (e.g. the load is below
the given limit). The program will be started but only run for very
few milliseconds before being suspended.
--mem makes is possible to only run a program if there is this amount
of memory free:
niceload --hard --mem 2g this_program_requires_2g_ram_to_run
--noswap works similar to --noswap in GNU Parallel: if the machine is
swapping slow down or do not run the program.
niceload --hard --noswap dont_run_this_program_if_swapping