What is the difference between LWP and threads?
2013-01-22 16:39
585 查看
This explains the difference between LWP-Process-Thread:
A 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.
A 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.
相关文章推荐
- What is the difference between user level threads and kernel level threads?
- What is the difference between "green" threads and "native" threads?
- what is the difference between processes and threads
- Linux Kernel: What is the major difference between the buffer cache and the page cache?
- What is the difference between syntax and semantic
- What is the difference between Listview and Treeview?
- Java-What is the difference between <? super E> and <? extends E>?
- What is the difference between HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR
- What is the basic difference between NSTimer, NSTask, NSThread and NSRunloop?
- what is the difference between json and javascript object.
- What is the difference between ContentPresenter and ContentControl?
- What is the difference between '/n' and '/r/n'? /n /r/n的区别是什么
- What is the difference between Constructor and ngOnInit?
- What is the difference between Facade and Gateway design patterns?
- What is the difference between user mode and kernel mode, and real mode and protected mode?
- What is The Difference Between Risk Appetite, Risk Tolerance and Risk Threshold?
- What is the difference between supervised learning and unsupervised learning?
- What is the difference between Terminal, Console, Shell, and Command Line?
- What is the difference between a Generative and Discriminative Algorithm?
- 文科和理科的区别(What is the difference between science and engineering)?