作者b9707114 (阿通)
看板LinuxDev
標題[問題] Linux pthread 問題
時間Fri Apr 22 00:34:33 2011
There are two different implementations of POSIX pthreads in Linux.
One is at user level, the other is as kernel threads .
Which one is installed on the system you are using?
這是小弟的作業,
我花了兩小時,上網找資料,看課本,還是不知道答案是什麼...
請各位幫忙.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.193.40.219
1F:推 shaopin:阿他不是叫你去你的system找? 不過這問題也很怪 04/22 11:14
2F:→ wgst88w:I guess the user level. 04/22 16:45
3F:→ chiang0823:應該兩種都會用吧?但是以使用者來說是user level 04/22 18:06
4F:→ jenallen:用ps看看一個小程式(開兩個threads)有沒有出現個別pid 04/23 22:56
5F:→ jenallen:有的話就是kernel thread, 不然就是user thread 04/23 22:57
6F:推 yuskeb:NPTL(Native Posix Thread Library)和LT(Linux Thread)嗎? 04/24 00:09
7F:→ yuskeb:試試"getconf GNU_LIBPTHREAD_VERSION" 04/24 00:10
8F:→ yuskeb:我目前看到用NPTL和LT的Linux都是kernel-aware threads 04/24 00:12
9F:→ yuskeb:純user-level threads大概是指GNU pth 04/24 00:13
11F:→ yuskeb:或在看看恐龍本(6e版以後才有threads章節) 04/24 00:14
12F:→ wgst88w:剛找了一下,確實還是要看系統,每種系統使用會有所不同! 04/24 00:44
14F:→ wgst88w:就端看板大在學校的桌上,是挑到兩種系統中的哪種了。 04/24 00:55
15F:→ littlejohn:如果你使用pthread(假設使用clone),會使用到kernel 04/24 01:25
16F:→ littlejohn:thread (pid會只有一個, tid才會有多個不同的) 04/24 01:26