title: How do I find threads that belong to the same process in Linux
body: <p>Since a <code>task_struct</code> is allocated for each thread in Linux, how to I find the threads that belong to the same process?</p>
  
  <p>So, that was the general question. To elaborate, I need to write a kernel function that traverses the threads that belong to a process (p), given  a pointer to its <code>task_struct</code> or pid, and do something with them (e.g. collect some information).</p>