When does swap start to be used? When does a process get an out of memory error and be killed

swapvirtual-memory

  1. When does swap start to be used? Is it when the memory is fully
    used? Or when the memory hasn't been fully used?
  2. When does a process get an "Out of memory" error and be killed by
    the kernel? is it when both RAM and swap are fully used? or just
    when RAM is?

Best Answer

When swap starts to be used is dependent on how you have your swappiness kernel parameter set. At swappiness 0 swapping will only occur when memory is fully used and at 100 it will occur as soon as possible. The default value is 60.

OOM errors occur when RAM and swap are completely full.

Related Question