What is the difference between LWP and threads?

This explains the difference between LWP-Process-Thread: 

light-weight process (LWP) is a means of achieving multitasking. In contrast to a regular (full-blown) process, an LWP shares all (or most of) its logical address space and system resources with other process(es); in contrast to a thread, a light-weight process has its own private process identifier and parenthood relationships with other processes. Moreover, while a thread can either be managed at the application level or by the kernel, an LWP is always managed by the kernel and it is scheduled as a regular process. One significant example of a kernel that supports LWPs is the Linux kernel.

On most systems, a light-weight process also differs from a full-blown process, in that it only consists of the bare minimum execution context and accounting information that is needed by the scheduler, hence the term light-weight. Generally, a process refers to an instance of a program, while an LWP represents a thread of execution of a program (indeed, LWPs can be conveniently used to implement threads, if the underlying kernel does not directly support them). Since a thread of execution does not need as much state information as a process, a light-weight process does not carry such information.

As a consequence of the fact that LWPs share most of their resources with other LWPs, they are unsuitable for certain applications, where multiple full-blown processes are needed, e.g. to avoid memory leaks (a process can be replaced by another one) or to achieve privilege separation (processes can run under other credentials and have other permissions). Using multiple processes also allows the application to more easily survive if a process of the pool crashes or is exploited.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值