Re: process 0 ("swapper")

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 15 Feb 2013 22:24:29 +0200, Kevin Wilson said:

> #if defined(CONFIG_SMP)
> 	sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu);
> #endif
> ...
> #define INIT_TASK_COMM "swapper" in include/linux/init_task.h
>
> Two questions:
> 1) why does this  #if defined(CONFIG_SMP) here ? shouldn't we name
>    it swapper also in non SMP mode ?

That code is entered once per CPU as the CPU is started up.  And that %d
doesn't make much sense in single-processor mode.

> 2) Is there a reason that we do not see it with ps aux  (and also not
> under proc; there is no /proc/0).

/bin/ps just pretty-prints stuff out of /proc - so you don't see it with
ps because you don't have a /proc/0.  And that's because in fs/proc/base.c
we see this code in proc_pid_lookup:

        tgid = name_to_int(dentry);
        if (tgid == ~0U)
                goto out;

In other words, if you ask for pid 0, it bails and doesn't return anything.

Attachment: pgp1tbkxoERGE.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux