Solved

Suspend a process in Linux

Posted on 2006-07-23
4
3,912 Views
Last Modified: 2012-05-05
Hi expert

How do swapout a suspended process   in Linux ? i.e

It should be moved from Main memory to swap without killing the process
and later on when resumed it must be swapped in back to main memory

0
Comment
Question by:mmadhuso
4 Comments
 
LVL 37

Expert Comment

by:Harisha M G
ID: 17164035
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 17164322
bg & fg as mentioned by mgh_mgharish suspend run a suspended process in background or foreground / interactively. You suspend the current interactive program with SIGSTOP (control-Z usually).
From your question I imagine you knew all that already.
Whether a process is swapped out or in is really not a regular user's concern. Linux manages memory as it will. Really, "Swap" is an old-fashioned term - Linux is a demand - paging system where the least recently used pages of memory are freed up as required. Those that have been written to (jargon is "are dirty") are written to "swap"; those that are (jargon) "clean" are simply discarded. "Clean" includes program and library code, which are paged back in from the executable when again needed. If you google for "demand paging" you may find some links - I have to go now.
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 17165767
I can only confirm what duncan_roe pointed out. There is no way under linux to force taks to moved to swap. Interesting, but You can prevent taks(some of its memory pages) from beeing moved to swap...
Also, just for a recors: after You SIGSTOP the application, You have to SIGCONT to wake it up again.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 17165960
> How do swapout a suspended process   in Linux ?
you don't need to do that, the kernel does it automatically for you, hence there is no API for it.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now