看板 LinuxDev 關於我們 聯絡資訊
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
shaopin:阿他不是叫你去你的system找? 不過這問題也很怪 04/22 11:14
wgst88w:I guess the user level. 04/22 16:45
chiang0823:應該兩種都會用吧?但是以使用者來說是user level 04/22 18:06
jenallen:用ps看看一個小程式(開兩個threads)有沒有出現個別pid 04/23 22:56
jenallen:有的話就是kernel thread, 不然就是user thread 04/23 22:57
yuskeb:NPTL(Native Posix Thread Library)和LT(Linux Thread)嗎? 04/24 00:09
yuskeb:試試"getconf GNU_LIBPTHREAD_VERSION" 04/24 00:10
yuskeb:我目前看到用NPTL和LT的Linux都是kernel-aware threads 04/24 00:12
yuskeb:純user-level threads大概是指GNU pth 04/24 00:13
yuskeb:http://www.gnu.org/software/pth/ 推薦看看這網站 04/24 00:13
yuskeb:或在看看恐龍本(6e版以後才有threads章節) 04/24 00:14
wgst88w:剛找了一下,確實還是要看系統,每種系統使用會有所不同! 04/24 00:44
wgst88w:http://tinyurl.com/42n882r ←找到的threads中文解釋。 04/24 00:48
wgst88w:就端看板大在學校的桌上,是挑到兩種系統中的哪種了。 04/24 00:55
littlejohn:如果你使用pthread(假設使用clone),會使用到kernel 04/24 01:25
littlejohn:thread (pid會只有一個, tid才會有多個不同的) 04/24 01:26