作者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