I started 4 processes doing heavy computations. The machine has 4 full cores, and each process is single-threaded, so they don't compete for CPU. However I realized that they require more memory than physically exist in this system (16GB). Now their allocated address space combined is about 20GB, so each of them has part of their address space swapped out.
So I decided to suspend one of those processes and I wanted to put its memory pages to swap, so that physical memory would serve only the three other processes. I assume that this will eventually happen while the three alive processes will try to access swapped-out pages. But I'd like to force it so that the computations wont have to wait for IO.
My questions:
Is it possible to force a suspended process' memory go to swap? (so that there wont be IO when alive processes will do new allocations)
Is it possible to force an alive process' memory to come back to RAM?
This is Debian SID.
You could suspend one of the processes for instance attaching a debugger to the process.
and let the linux scheduler do the rest. When the first three processes terminate you can just detach the debugger to resume the fourth process.
You can achieve the same purpose just by issuing SIGSTOP to the process:
And
To resume it when the resources become available. In future you might consider using some job scheduler such as torque to schedule the processes according to their resource requirements semi automatically.
Edit: I did not pay attention to the original question and missed that suspending the process is not an issue. The issue is that simply moving pages to swap and back takes a long time.