Re: pthreads and the kernel

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

 



> 1.there is no direct kernel support for threads.
Linux kernel do not see threads per se, but only processes. For any
thread in userspace, there would be a task_struct in the kernel. The
mm/active_mm should be shared among different threads.
> 2.pthreads is the most popular threads library in linux.
See the reference to ntpl in Tyler's mail
> 3.it uses the clone system call to create "threads" which are
>    just another process that shares its creator's memory space.
yes. clone end up calling a sys_clone which in turn calls do_form with
some flags specific to clone-ing like CLONE_VM. I mean to say the
implementaion of clone-is a subset of fork(), thus creating an
instance of proc_struct.
>
> 4.the kernel sees these "threads" as just another process,
>    and schedules them like an autonomous process in the system.
> 5. all pthread does is handle synchronizing, message passing, etc,
>    between the threads. it does not responsible for their scheduling ?
I do not know exactly, but it is almost right. In scheduler code I did
not see anything to differenciate among processes of a thread and
independent processes. But I can be wrong.
>
> and last but not least, and forgive me if it is out of context a little:
> 6. where can I find the sources of phtread ?
> 7. is there another popular threads implementation in linux I should
>      look at ? it's a jungle out there...
>From Fedora 5 onwards pthreads are deprecated. NPTL support has been
in place for quite some time. Other distros may follow/ alread lead.
Maybe you should concentrate more on nptl.

Regards,
om.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[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