[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: processes and swapping
Hi...
On Thu, Nov 6, 2008 at 1:16 PM, Sukanto Ghosh
<sukanto.cse.iitb@xxxxxxxxx> wrote:
> Hi,
>
> Couple of questions:
>
> 1. How to determine the number of processes in memory ? (inside
> kernel code, not shell : ps -ef | wc -l )
i forgot the list name, but all you need is to walk over the run queue
that contains TASK_RUNNING processes
> 2. Is there any provision for swapping out entire process in linux (as
> solaris has) ?
never saw such function before. You can do things like "dd
if=/dev/zero bs=4K" so the pages will be forced to be swapped out, but
then it will swap all pages...not just ones belong to single process.
> If no, then how to make sure that a process all of whose pages have
> been swapped out is not scheduled again ? (may be by changing the
> process-state)
by making that process state as non TASK_RUNNING (or
TASK_RUNNABLE...forgot which one).
> And, how to later enable the process so that it gets scheduled ?
put it back to TASK_RUNNING/RUNNABLE. Make sure you use
function...IIRC set_task_state() to avoid race condition in SMP.
regards,
Mulyadi.
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ