摘要:
process使用fork()函数产生一个和父进程一摸一样的子进程。然后再使用exec函数用另一个program代替这个子进程。这样就产生了两个进程。 而thread则使用pthread_create()函数产生一个新的thread,这个thread和以前的thread没有什么上下级的关系,并且它调用的是一个“函数”,不是一个独立的程序。 阅读全文
posted @ 2011-05-26 19:54 天地玄黄 阅读(286) 评论(0) 推荐(0)
|
摘要:
process使用fork()函数产生一个和父进程一摸一样的子进程。然后再使用exec函数用另一个program代替这个子进程。这样就产生了两个进程。 而thread则使用pthread_create()函数产生一个新的thread,这个thread和以前的thread没有什么上下级的关系,并且它调用的是一个“函数”,不是一个独立的程序。 阅读全文
posted @ 2011-05-26 19:54 天地玄黄 阅读(286) 评论(0) 推荐(0)
摘要:
在Linux中使用线程相关的东西就要使用到这个头文件,但这还不算。如果仅仅使用这个头文件,会出现错误: undefined reference to `pthread_create'collect2: ld returned 1 exit statusmake: *** [threadid] Error 1 之所以出现这样的错误,是因为我们没有链接相应的函数库。所以在编译的时候要加上 –lpth... 阅读全文
posted @ 2011-05-26 14:55 天地玄黄 阅读(12056) 评论(0) 推荐(1)
摘要:
和 threads 相关的信息: · thread ID · register value · a stack · scheduling priority and policy · signal mask · errno variable · thread-specific data 很多threads 所共享的东西: · .text · global and heap memory · stac... 阅读全文
posted @ 2011-05-26 14:08 天地玄黄 阅读(247) 评论(0) 推荐(0) |
||