Re: What's the relationship between pid and pid_t

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

 



Hi,

1) If the user space process has existed, why the kernel still need to store a reference to it?

2) From <understanding the linux kernel> 3rd edition, I found one pid structure can be corresponded to multi pid_t, and if we want to look up one task_struct by pid_t, we need to use a PID hash table. Honestly, I am confused by this flow.


On Tue, Jul 20, 2010 at 12:58 PM, Neependra Khare <neependra.khare@xxxxxxxxx> wrote:


On Tue, Jul 20, 2010 at 8:26 AM, Aiolia Lea <casmyu@xxxxxxxxx> wrote:

Then, what's the pid structure used for? and what's the relationship between pid structure and pid_t?

From :-If you need to store a persistent reference to a user space process use a
struct pid *.  Not a task_struct reference.

References can potentially last for a long time after user space processes
have exited so holding a reference to a tiny struct pid is much cheaper
memory wise.  In addition a struct pid is a drop in replacement for a
pid_t (except for the need for reference counting).  A struct pid can
reference process groups, thread groups, and sessions not just individual
processes.  Further a struct pid is immune from pid wrap around, removing
a whole class of theoretical problems from being issues in the kernel.

Regards,
Neependra

 

Why the kernel required to involved pid this structure?

Hope you could give me some explanation or some  links.

Thank you very much~
--
Best Regards!
Aiolia Lea




--
Best Regards!
Aiolia Lea

[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