Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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:

  1. 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)

  2. Is it possible to force an alive process' memory to come back to RAM?

This is Debian SID.

share|improve this question

1 Answer 1

You could suspend one of the processes for instance attaching a debugger to the process.

 gdb process_executable process_pid

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:

 kill -stop process_pid

And

 kill -cont process_pid

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.

share|improve this answer
1  
I know how to suspend a task, and this is not what this question is about. What I'd like to know is how to manage where memory of suspended or active process are placed by OS. –  liori Apr 21 '12 at 16:06
    
Looks like the general opinion holds it is better left to Linux to decide serverfault.com/questions/110436/… –  Dmitri Chubarov Apr 21 '12 at 16:12
1  
In general situation I agree. In this specific situation this slows down my computations significantly for some time… –  liori Apr 21 '12 at 16:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.