Am a newbie to OS , So, I want to know about the pthread_create (Standardized Interface ) in Linux ? What type of thread it creates ? User Level Thread or Kernel Level Thread ? Justify !
Asked
Active
Viewed 378 times
1
-
-1: Duplicate of http://stackoverflow.com/questions/8639150/is-pthread-library-actually-a-user-thread-solution – Bob Murphy Jan 30 '13 at 04:03
-
@Bob, I can find nothing in that supposed dupe mentioning Linux. Whether pthreads is user or kernel mode depends entirely on the implementation. – paxdiablo Jan 30 '13 at 04:16
-
@paxdiablo: You're right; I removed my down-vote. – Bob Murphy Jan 30 '13 at 05:48
-
And at first, the "user level" or "kernel level" thread difference is not very important. What is hard is to understand what threads are and how to code them. Their implementation at "user level" or "kernel level" is an (important) implementation detail. – Basile Starynkevitch Jan 30 '13 at 06:30
2 Answers
2
PThreads in Linux gives you kernel-level threads, not user-level.
This is obvious if you look at the man page for pthreads: (look for the word Both
):
Both threading implementations employ the Linux clone(2) system call.
In this context, the word "Both" refers to the now unsupported LinuxThreads implementation, and the newer NPTL (Native POSIX Threads Library) in glibc.
See also this answer to get an understanding on how kernel thread scheduling works under Linux.
0
Read also a good Posix thread tutorial like this.
And reading a good book on advanced linux programming will also be relevant.

Basile Starynkevitch
- 223,805
- 18
- 296
- 547