Linux does not distinguish between a process (task) and a thread. The library calls fork () and pthread_create () uses the same clone () system call. The difference between fork () and pthread_create () is the bitmask passed to clone (). This bitmask describes which resources (memory, files, file systems, signal handler, ...). See Man clone (2) for more details.
, -, , clone(), , . , clone(), CLONE_THREAD .
* while_each_thread * include sched.h. :
struct task_struct *me = current();
struct task_stuct *t = me;
do {
whatever(t);
}while_each_thread(me, t);