Is there a possibility to prevent swapping for a single process?
This process is an in-memory-database and should not be moved to virtual ram.

all other processes should still be swap-able.

I need something like the "lock pages in memory" option of the SQL-Server.

1 Answer 1


If a process starts swapping, it's either very poorly coded and not releasing RAM when it should or your server doesn't have enough RAM available to handle all the tasks it's currently performing and you should expand the RAM capacity.

If that's really not an option budget-wise or if the machine is already at maximum RAM capacity, you could schedule a task that kills and restarts the process every hour or so (or more frequent if needed). Note that this should really be a last-resort and temporary solution, as it's not really so much of a solution, but just a work-around.

As for the core of your question, there is no way that I know of to prevent a program from swapping. It's basic OS behaviour when a process runs out of physical memory to use to prevent your machine from crashing.

  • 1
    The server already has very much RAM. And even if everything is loaded there are still 20 GB RAM available. Dont know why the system begins to page the process but it does :( Nov 24, 2011 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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