linux内核线程api,Linux内核v2.6中的pthread与kthread

这是一个概念性问题.

根据这个post,pthread实际上是使用clone()系统调用实现的.因此,我们可以推断在用户空间中有一个内核线程(或轻量级进程)备份pthread.内核知道pthread并且可以像进程一样安排它.

至于kthread,根据Robert Love,kthreads也是用clone()系统调用创建的:

clone(CLONE_VM| CLONE_FS | CLONE_FILES | CLONE_SIGHAND, 0)

所以pthread和kthread都使用clone()调用.我的第一个问题是:

>这两种线程之间有区别吗?

为了回答我自己的问题,我继续读到:

The significant difference between kernel threads and normal processes

is that kernel threads do not have an address space (in fact, their mm

pointer is NULL).

这有区别吗?我的意思是,由pthread_create()创建的线程与正常进程共享地址空间.相反,kthread没有自己的地址空间.那是对的吗?

还有什么不同?

解决方法:

In contrast, a kthread does not have its own address space. Is that correct?

a thread created by pthread_create() shares the address space with the normal process.

pthreads:pthread_create()用于用户空间,其中应用程序中的多个线程共享相同的进程地址空

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值