Re: Which process is associated with process ID 0 (swapper)

From: Jan Engelhardt
Date: Thu Apr 20 2006 - 18:10:48 EST


>> This must be a trick question. Linux is not VAX/VMS. There is no
>> swapper process. Check in /proc. Processes start at 1. Even
>> kernel threads have PIDs greater than 1.
>
>Linux really has swapper process ;)
>
To be precise, it has more than one.

When you hit an OOPS, the trace [1] might show:
"Pid: 0, comm: swapper Not tainted 2.6.11.6"

Plus you see one of these per CPU [ps aufwwx]:
root 106 0.0 0.0 0 0 ? S Apr20 0:04 [kswapd0]

So, a question to the public: what swapper swaps, and what's swapper(as in
pid 0) in oops, if there's no PID 0?

>I'm writing kernel module that hooks into netfilter code. I can catch
>packet's information and its owner process. The first SYN packet of
>handshaking belongs to real user-space socket/process. After timeout,
>several SYN packets are generated by kernel-space swapper process (PID
>0) Is there anyway to find out the relationship between them in
>_kernel_space_ (module context).
>
Is your code doing it like ipt_owner does?



[1] http://www.ussg.iu.edu/hypermail/linux/kernel/0504.0/0416.html


Jan Engelhardt
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/